docstr: Split a LineString with another (Multi)LineString or (Multi)Polygon
docstr_tok: ["Split","a","LineString","with","another","(","Multi",")","LineString","or","(","Multi",")","Polygon"]
code: def _split_line_with_line(line, splitter):
      """Split a LineString with another (Multi)LineString or (Multi)Polygon"""
  
      # if splitter is a polygon, pick it's boundary
      if splitter.geom_type in ("Polygon", "MultiPolygon"):
          splitter = splitter.boundary
  
      if not isinstance(line, LineString):
          raise GeometryTypeError("First argument must be a LineString")
      if not isinstance(splitter, LineString) and not isinstance(
          splitter, MultiLineString
      ):
          raise GeometryTypeError(
              "Second argument must be either a LineString or a MultiLineString"
          )
  
      # |    s\l   | Interior | Boundary | Exterior |
      # |----------|----------|----------|----------|
      # | Interior |  0 or F  |    *     |    *     |   At least one of these two must be 0
      # | Boundary |  0 or F  |    *     |    *     |   So either '0********' or '[0F]**0*****'
      # | Exterior |    *     |    *     |    *     |   No overlapping interiors ('1********')
      relation = splitter.relate(line)
      if relation[0] == "1":
          # The lines overlap at some segment (linear intersection of interiors)
          raise ValueError(
              "Input geometry segment overlaps with the splitter."
          )
      elif relation[0] == "0" or relation[3] == "0":
          # The splitter crosses or touches the line's interior --> return multilinestring from the split
          return line.difference(splitter)
      else:
          # The splitter does not cross or touch the line's interior --> return collection with identity line
          return [line]
  
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 SplitOp obj's underlying member method code with example usage: obj._split_line_with_line(line, splitter) and returns: line, list