code: def is_valid_geometry(geometry):
      
      if isinstance(geometry, Polygon) or isinstance(geometry, MultiPolygon):
          return True
      else:
          return False
docs: Confirm that the geometry type is of type Polygon or MultiPolygon.
  
      Args:
          geometry (BaseGeometry): BaseGeometry instance (e.g. Polygon)
  
      Returns:
          bool