def partition(sequence, predicate):
    """
    Partition the sequence into two lists, according to the
    function provided.

    Args:
        sequence: A sequence of elements.
        predicate: A function of one argument, returning bool.

    Returns:
        A tuple of lists, where the first list contains all
        elements that pass the test, and the second list all
        other elements.
    """
    list1, list2 = [], []
    for elem in sequence:
        if predicate(elem):
            list1.append(elem)
        else:
            list2.append(elem)
    return list1, list2