from functools import reduce


def partition(data, pred):
    """
    Behaves as a simple filter, but returns a tuple with two lists.
    The first one contains elements where the predicate returned True
    and the second one the rest.

    >>> partition([0, 1, 2, 3, 4, 5], lambda x: x % 2)
    ([1, 3, 5], [0, 2, 4])
    """
    # append returns None and we want to return the list, that is why there
    # is the or statement
    return reduce(lambda x, y: x[not pred(y)].append(y) or x, data, ([], []))