>>> from Redy.Collections import Traversal, Flow
    >>> def mul(a: int, b: int): return a * b
    >>> lst: Iterable[int] = [1, 2, 3]
    >>> x = Flow(lst)[Traversal.reduce_by(mul)].unbox
    >>> assert x is 6

def reduce_by(fn: Callable[[T1, T1], T1]) -> Callable[[ActualIterable[T1]], T1]:
    """
    >>> from Redy.Collections import Traversal, Flow
    >>> def mul(a: int, b: int): return a * b
    >>> lst: Iterable[int] = [1, 2, 3]
    >>> x = Flow(lst)[Traversal.reduce_by(mul)].unbox
    >>> assert x is 6
    """
    return lambda collection: functools.reduce(fn, collection)