code: def _polygon_from_flatcoords(coords, offsets1, offsets2):
      # recreate rings
      ring_lengths = np.diff(offsets1)
      ring_indices = np.repeat(
          np.arange(len(ring_lengths)), ring_lengths
      )
      rings = creation.linearrings(coords, indices=ring_indices)
  
      # recreate polygons
      polygon_rings_n = np.diff(offsets2)
      polygon_indices = np.repeat(
          np.arange(len(polygon_rings_n)), polygon_rings_n
      )
      result = np.empty(len(offsets2) - 1, dtype=object)
      result = creation.polygons(
          rings, indices=polygon_indices, out=result
      )
      result[polygon_rings_n == 0] = creation.empty(
          1, geom_type=GeometryType.POLYGON
      ).item()
  
      return result
  
file_path: shapely/shapely/_ragged_array.py
imports: import numpy
  from shapely import creation
  from shapely._geometry import GeometryType, get_coordinate_dimension, get_parts, get_rings, get_type_id
  from shapely.coordinates import get_coordinates
  from shapely.predicates import is_empty
label_desc: Use image node_id 13 for calling a global function with example usage: _polygon_from_flatcoords(coords, offsets1, offsets2) and returns: result