code: def _prepare_location(
      location: Union[str, List[float]]
  ) -> Optional[dict]:
      if location is None:
          return None
  
      value = location
      # if isinstance(location, Geocoder):
      #     kind = RegionKind.region_ids
      #     value = location.unique_ids()
  
      if isinstance(location, str):
          kind = RegionKind.region_name
  
      elif isinstance(location, list):
          if len(location) == 0 or len(location) % 2 != 0:
              raise ValueError(LOCATION_LIST_ERROR_MESSAGE)
          kind = RegionKind.coordinates
  
      elif pandas and isinstance(location, pandas.DataFrame):
          if not LOCATION_COORDINATE_COLUMNS.issubset(
              location.columns
          ) and not LOCATION_RECTANGLE_COLUMNS.issubset(
              location.columns
          ):
              raise ValueError(LOCATION_DATAFRAME_ERROR_MESSAGE)
          kind = RegionKind.data_frame
  
      else:
          raise ValueError("Wrong location type: " + location.__str__())
  
      return {"type": kind.value, "data": value}
  
file_path: lets-plot/python-package/lets_plot/plot/geom_livemap_.py
imports: from enum import Enum
  from typing import Union, Optional, List
  from lets_plot._global_settings import MAPTILES_KIND, MAPTILES_URL, MAPTILES_THEME, MAPTILES_ATTRIBUTION, GEOCODING_PROVIDER_URL, GEOCODING_ROUTE, TILES_RASTER_ZXY, TILES_VECTOR_LETS_PLOT, MAPTILES_MIN_ZOOM, MAPTILES_MAX_ZOOM, TILES_SOLID, MAPTILES_SOLID_FILL_COLOR, TILES_CHESSBOARD
  from lets_plot._global_settings import has_global_value, get_global_val
  from .geom import _geom
label_desc: Use image node_id 4 for calling a global function with example usage: _prepare_location(location) and returns: dict, None