def augment_intervals(it, i, key):
    last = None
    for value in it:
        k = key(value)
        if last is not None and k < last:
            raise ValueError('invalid order')
        yield k, i, value
dataset/ETHPy150Open bioinformed/vgraph/vgraph/intervals.py/augment_intervals/original