def get_pricing(driver_type, driver_name, pricing_file_path=None):
 if (driver_type not in VALID_PRICING_DRIVER_TYPES):
  raise AttributeError('Invalid driver type: %s', driver_type)
 if (driver_name in PRICING_DATA[driver_type]):
  return PRICING_DATA[driver_type][driver_name]
 if (not pricing_file_path):
  pricing_file_path = get_pricing_file_path(file_path=pricing_file_path)
 with open(pricing_file_path) as fp:
  content = fp.read()
 pricing_data = json.loads(content)
 size_pricing = pricing_data[driver_type][driver_name]
 for driver_type in VALID_PRICING_DRIVER_TYPES:
  pricing = pricing_data.get(driver_type, None)
  if pricing:
   PRICING_DATA[driver_type] = pricing
 return size_pricing

def get_pricing ( driver_type , driver_name , pricing_file_path = None ) : if ( driver_type not in VALID_PRICING_DRIVER_TYPES ) : raise AttributeError ( 'Invalid driver type: %s' , driver_type ) if ( driver_name in PRICING_DATA [ driver_type ] ) : return PRICING_DATA [ driver_type ] [ driver_name ] if ( not pricing_file_path ) : pricing_file_path = get_pricing_file_path ( file_path = pricing_file_path ) with open ( pricing_file_path ) as fp : content = fp . read ( ) pricing_data = json . loads ( content ) size_pricing = pricing_data [ driver_type ] [ driver_name ] for driver_type in VALID_PRICING_DRIVER_TYPES : pricing = pricing_data . get ( driver_type , None ) if pricing : PRICING_DATA [ driver_type ] = pricing return size_pricing
return pricing for the provided driver .