code: def invalid_multipoly_handler(gdf, relation, way_ids):
      
  
      try:
          gdf_clean = gdf.dropna(subset=['geometry'])
          multipoly = MultiPolygon(list(gdf_clean['geometry']))
          return multipoly
  
      except Exception:
          log("Invalid geometry at relation id %s.\nWay-ids of the invalid MultiPolygon:" % (
          relation['id'], str(way_ids)))
          return None
docs: Handles invalid multipolygon geometries when there exists e.g. a feature without 
      geometry (geometry == NaN)
  
      Parameters
      ----------
  
      gdf : gpd.GeoDataFrame
          GeoDataFrame with Polygon geometries that should be converted into a MultiPolygon object.
      relation : dict
          OSM 'relation' dictionary
      way_ids : list
          A list of 'way' ids that should be converted into a MultiPolygon object.