code: def _query(data, forward, provider, throttle_time, **kwargs):
      # generic wrapper for calls over lists to geopy Geocoders
      from geopy.geocoders.base import GeocoderQueryError
      from geopy.geocoders import get_geocoder_for_service
  
      if forward:
          if not isinstance(data, pd.Series):
              data = pd.Series(data)
      else:
          if not isinstance(data, geopandas.GeoSeries):
              data = geopandas.GeoSeries(data)
  
      if isinstance(provider, str):
          provider = get_geocoder_for_service(provider)
  
      coder = provider(**kwargs)
      results = {}
      for i, s in data.items():
          try:
              if forward:
                  results[i] = coder.geocode(s)
              else:
                  results[i] = coder.reverse(
                      (s.y, s.x), exactly_one=True
                  )
          except (GeocoderQueryError, ValueError):
              results[i] = (None, None)
          time.sleep(throttle_time)
  
      df = _prepare_geocode_result(results)
      return df
  
file_path: geopandas/geopandas/tools/geocoding.py
imports: from collections import defaultdict
  import time
  import pandas
  from shapely.geometry import Point
  import geopandas
label_desc: Use image node_id 4 for calling a global function with example usage: _query(data, forward, provider, throttle_time) and returns: df