docstr: Creates polygons from a source of lines
  
  The source may be a MultiLineString, a sequence of LineString objects,
  or a sequence of objects than can be adapted to LineStrings.
docstr_tok: ["Creates","polygons","from","a","source","of","lines","The","source","may","be","a","MultiLineString",",","a","sequence","of","LineString","objects",",","or","a","sequence","of","objects","than","can","be","adapted","to","LineStrings","."]
code: def polygonize(self, lines):
      """Creates polygons from a source of lines
  
      The source may be a MultiLineString, a sequence of LineString objects,
      or a sequence of objects than can be adapted to LineStrings.
      """
      source = getattr(lines, "geoms", None) or lines
      try:
          source = iter(source)
      except TypeError:
          source = [source]
      finally:
          obs = [self.shapeup(line) for line in source]
      collection = shapely.polygonize(obs)
      return collection.geoms
  
imports: from warnings import warn
  import shapely
  from shapely.algorithms.polylabel import polylabel
  from shapely.errors import GeometryTypeError, ShapelyDeprecationWarning
  from shapely.geometry import GeometryCollection, LineString, MultiLineString, MultiPoint, Point, Polygon, shape
  from shapely.geometry.base import BaseGeometry, BaseMultipartGeometry
  from shapely.geometry.polygon import orient
  from shapely.prepared import prep
label_desc: Use image node_id 2 for calling the CollectionOperator obj's underlying member method code with example usage: obj.polygonize(lines) and returns: collection