def _lines_only(shape):
    """
    Extract the lines (LineString, MultiLineString) from any geometry. We
    expect the input to be mostly lines, such as the result of an intersection
    between a line and a polygon. The main idea is to remove points, and any
    other geometry which might throw a wrench in the works.
    """

    lines = _explode_lines(shape)
    if len(lines) == 1:
        return lines[0]
    else:
        return MultiLineString(lines)