def closest_station(lat, lon, cache_dir):
 if ((lat is None) or (lon is None) or (not os.path.isdir(cache_dir))):
  return
 stations = bom_stations(cache_dir)
 def comparable_dist(wmo_id):
  'A fast key function for psudeo-distance from lat/lon.'
  (station_lat, station_lon) = stations[wmo_id]
  return (((lat - station_lat) ** 2) + ((lon - station_lon) ** 2))
 return min(stations, key=comparable_dist)

def closest_station ( lat , lon , cache_dir ) : if ( ( lat is None ) or ( lon is None ) or ( not os . path . isdir ( cache_dir ) ) ) : return stations = bom_stations ( cache_dir ) def comparable_dist ( wmo_id ) : ( station_lat , station_lon ) = stations [ wmo_id ] return ( ( ( lat - station_lat ) ** 2 ) + ( ( lon - station_lon ) ** 2 ) ) return min ( stations , key = comparable_dist )
return the zone_id .