def get_ticket_price(data, seat=None, ecard=None): print('get_ticket_price-data', data) if data.get('areaInfo') is None: if data.get('partnerPrice') is None: return data.get('marketPrice'), None else: return data.get('partnerPrice'), None else: if seat is None: return data.get('partnerPrice'), None else: area_id = seat.get('areaId') if ecard is None: for area in data.get('areaInfo'): if area.get('areaId') == area_id: return area.get('areaPrice'), area.get('areaServiceFee') else: pass