Partitions an iterable with a predicate into two iterables, one with elements satisfying
    the predicate and one with elements that do not satisfy it.

    :returns: a tuple (satisfiers, unsatisfiers).

def partition_iter(pred, iterable):
    """Partitions an iterable with a predicate into two iterables, one with elements satisfying
    the predicate and one with elements that do not satisfy it.

    :returns: a tuple (satisfiers, unsatisfiers).
    """
    left, right = itertools.tee(iterable, 2)
    return (
        (x for x in left if pred(x)),
        (y for y in right if not pred(y))
    )