def polylinesort(fbasename=None, log=None):
fext = os.path.splitext(fbasename)[<NUM_LIT:1>][<NUM_LIT:1>:].strip().lower()<EOL>if fext != '<STR_LIT>':<EOL><INDENT>print('<STR_LIT>')<EOL>sys.exit(<NUM_LIT:1>)<EOL><DEDENT>fread = open(fbasename, '<STR_LIT:r>')<EOL>first = True<EOL>polyline_vertices = []<EOL>line_segments = []<EOL>for line in fread:<EOL><INDENT>element, x_co, y_co, z_co = line.split()<EOL>if element == '<STR_LIT:v>':<EOL><INDENT>polyline_vertices.append(<EOL>[util.to_float(x_co), util.to_float(y_co), util.to_float(z_co)])<EOL><DEDENT>elif element == '<STR_LIT:l>':<EOL><INDENT>p1 = x_co<EOL>p2 = y_co<EOL>line_segments.append([int(p1), int(p2)])<EOL><DEDENT><DEDENT>fread.close()<EOL>if log is not None:<EOL><INDENT>log_file = open(log, '<STR_LIT:a>')<EOL>"""<STR_LIT>"""<EOL>log_file.close()<EOL><DEDENT>return None<EOL>
Sort separate line segments in obj format into a continuous polyline or polylines.
    NOT FINISHED; DO NOT USE

    Also measures the length of each polyline

    Return polyline and polylineMeta (lengths)