text: """ Utility functions. """
  
  from shapely.geometry import Point, LineString
  
  
  def cut(line, distance):
      # Cuts a line in two at a distance from its starting point
      if distance <= 0.0 or distance >= line.length:
          return [LineString(line)]
      coords = list(line.coords)
      for i, p in enumerate(coords):
          pd = line.project(Point(p))
          if pd == distance:
              return [
                  LineString(coords[:i+1]),
                  LineString(coords[i:])]
          if pd > distance:
              cp = line.interpolate(distance)
              return [
                  LineString(coords[:i] + [(cp.x, cp.y)]),
                  LineString([(cp.x, cp.y)] + coords[i:])]
  