def reverse_geocode(lat, lng):
 try:
  result = get_first_mapbox_geocode_result(('%s,%s' % (lng, lat)))
 except HTTPError:
  logger.exception('HTTP status error when calling Mapbox.')
  raise GeoLookupException
 except ConnectionError:
  logger.exception('Cannot open connection to Mapbox.')
  raise GeoLookupException
 if result:
  return result_to_country_region_city(result)
 else:
  return (None, None, None)

def reverse_geocode ( lat , lng ) : try : result = get_first_mapbox_geocode_result ( ( '%s,%s' % ( lng , lat ) ) ) except HTTPError : logger . exception ( 'HTTP status error when calling Mapbox.' ) raise GeoLookupException except ConnectionError : logger . exception ( 'Cannot open connection to Mapbox.' ) raise GeoLookupException if result : return result_to_country_region_city ( result ) else : return ( None , None , None )
reverse geocoding is the process of converting geographic coordinates into a human-readable address .