<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def filter(polylines, min_len=20):
 """ filter polylines shorter than given min length """

    filtered = []
    for n in range(len(polylines) - 1, -1, -1):
        if lengths(polylines[n]).sum() < min_len:
            filtered.append(polylines.pop(n))
    return filtered