def split_by(pred, seq):
    """Lazily splits the start of the sequence,
       consisting of items passing pred, from the rest of it."""
    a, b = tee(seq)
    return takewhile(pred, a), dropwhile(pred, b)
Lazily splits the start of the sequence,
       consisting of items passing pred, from the rest of it.
funcy/seqs.py