def partition_by(f, seq):
    """Lazily partition seq into continuous chunks with constant value of f."""
    f = make_func(f)
    for _, items in groupby(seq, f):
        yield items
Lazily partition seq into continuous chunks with constant value of f.
funcy/seqs.py