code: def _parse_geometry(geometry):
          
          if isinstance(geometry, str):
              geometry = shapely.wkt.loads(geometry)
          elif isinstance(geometry, dict):
              geometry = shapely.geometry.shape(geometry)
          elif not isinstance(geometry, shapely.geometry.base.BaseGeometry):
              raise TypeError('Unsupported geometry representation')
  
          if not isinstance(geometry, (shapely.geometry.Polygon, shapely.geometry.MultiPolygon)):
              raise ValueError('Supported geometry types are polygon and multipolygon, got {}'.format(type(geometry)))
  
          return geometry
docs: Parses given geometry into shapely object
  
          :param geometry:
          :return: Shapely polygon or multipolygon
          :rtype: shapely.geometry.Polygon or shapely.geometry.MultiPolygon
          :raises TypeError