code: def map_geometries(func, obj):
      
      simple_types = [
          'Point',
          'LineString',
          'MultiPoint',
          'MultiLineString',
          'Polygon',
          'MultiPolygon',
      ]
  
      if obj['type'] in simple_types:
          return func(obj)
      elif obj['type'] == 'GeometryCollection':
          geoms = [func(geom) if geom else None for geom in obj['geometries']]
          return {'type': obj['type'], 'geometries': geoms}
      elif obj['type'] == 'Feature':
          geom = func(obj['geometry']) if obj['geometry'] else None
          return {
              'type': obj['type'],
              'geometry': geom,
              'properties': obj['properties'],
          }
      elif obj['type'] == 'FeatureCollection':
          feats = [map_geometries(func, feat) for feat in obj['features']]
          return {'type': obj['type'], 'features': feats}
      else:
          raise ValueError("Invalid GeoJSON object %s" % repr(obj))
docs: Returns the result of passing every geometry in the given geojson object
      through func.
  
      :param func: Function to apply to tuples
      :type func: function
      :param obj: A geometry or feature to extract the coordinates from.
      :type obj: GeoJSON
      :return: The result of applying the function to each geometry
      :rtype: list
      :raises ValueError: if the provided object is not geojson.