code: def _intersect_multipolygon(shape, tile_bounds, clip_bounds):
      
  
      polys = []
      for poly in shape.geoms:
          if tile_bounds.intersects(poly):
              if not clip_bounds.contains(poly):
                  poly = clip_bounds.intersection(poly)
  
              # the intersection operation can make the resulting polygon
              # invalid. including it in a MultiPolygon would make that
              # invalid too. instead, we skip it, and hope it wasn't too
              # important.
              if not poly.is_valid:
                  continue
  
              if poly.type == 'Polygon':
                  polys.append(poly)
              elif poly.type == 'MultiPolygon':
                  polys.extend(poly.geoms)
  
      return geometry.MultiPolygon(polys)
docs: Return the parts of the MultiPolygon shape which overlap the tile_bounds,
      each clipped to the clip_bounds. This can be used to extract only the
      parts of a multipolygon which are actually visible in the tile, while
      keeping those parts which extend beyond the tile clipped to avoid huge
      polygons.