code: def _path_from_polygon(polygon):
      from matplotlib.path import Path
  
      if isinstance(polygon, shapely.MultiPolygon):
          return Path.make_compound_path(
              *[_path_from_polygon(poly) for poly in polygon.geoms]
          )
      else:
          return Path.make_compound_path(
              Path(np.asarray(polygon.exterior.coords)[:, :2]),
              *[
                  Path(np.asarray(ring.coords)[:, :2])
                  for ring in polygon.interiors
              ],
          )
  
file_path: shapely/shapely/plotting.py
imports: import numpy
  import shapely
label_desc: Use image node_id 2 for calling a global function with example usage: _path_from_polygon(polygon) and returns: Path, Path