def itersplit(p, it):
    elems = []
    for x in it:
        if p(x) and len(elems) > 0:
            yield elems
            elems = []
        else:
            elems.append(x)
    if len(elems) > 0:
        yield elems
dataset/ETHPy150Open pcapriotti/pledger/pledger/util.py/itersplit/original