def pairwise(iterable):
    a,b = itertools.tee(iterable)
    try:
        b.next()
    except StopIteration:
        pass
    return itertools.izip(a,b)
Iterator over pairs of elements from the given iterable.
dataset/ETHPy150Open cloudmatrix/esky/esky/util.py/pairwise