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
filter polylines shorter than given min length