def partition(items, predicate=bool):
    "Partition `items` by `predicate`.\n\n    Parameters\n    ----------\n    items : iterable\n    predicate : callable\n        A function that will be mapped over each element in `items`. The\n        elements will partitioned based on whether the return value is false or\n        true.\n\n    Returns\n    -------\n    A tuple with two generators, the first for 'false' items and the second for\n    'true' ones.\n\n    Notes\n    -----\n    Taken from Peter Otten's snippet posted at\n    https://nedbatchelder.com/blog/201306/filter_a_list_into_two_parts.html\n    "
    (a, b) = tee(((predicate(item), item) for item in items))
    return ((item for (pred, item) in a if (not pred)), (item for (pred, item) in b if pred))
Partition `items` by `predicate`.

Parameters
----------
items : iterable
predicate : callable
    A function that will be mapped over each element in `items`. The
    elements will partitioned based on whether the return value is false or
    true.

Returns
-------
A tuple with two generators, the first for 'false' items and the second for
'true' ones.

Notes
-----
Taken from Peter Otten's snippet posted at
https://nedbatchelder.com/blog/201306/filter_a_list_into_two_parts.html
def partition(items, predicate=bool):
    "Partition `items` by `predicate`.\n\n    Parameters\n    ----------\n    items : iterable\n    predicate : callable\n        A function that will be mapped over each element in `items`. The\n        elements will partitioned based on whether the return value is false or\n        true.\n\n    Returns\n    -------\n    A tuple with two generators, the first for 'false' items and the second for\n    'true' ones.\n\n    Notes\n    -----\n    Taken from Peter Otten's snippet posted at\n    https://nedbatchelder.com/blog/201306/filter_a_list_into_two_parts.html\n    "
    (a, b) = tee(((predicate(item), item) for item in items))
    return ((item for (pred, item) in a if (not pred)), (item for (pred, item) in b if pred))