def with_prev(seq, fill=None):
    """Yields each item paired with its preceding: (item, prev)."""
    a, b = tee(seq)
    return zip(a, chain([fill], b))
Yields each item paired with its preceding: (item, prev).
funcy/seqs.py