def filter_separate(pred, seq):
    """Generic filter function that produces two lists, one for which the
    predicate is true, and the other elements."""
    inlist = []
    outlist = []
    for e in seq:
        if pred(e):
            inlist.append(e)
        else:
            outlist.append(e)
    return inlist, outlist