def prev_this_next(it, sentinel=None):
i1, i2, i3 = tee(it, <NUM_LIT:3>)<EOL>next(i3, None)<EOL>return zip(chain([sentinel], i1), i2, chain(i3, [sentinel]))<EOL>
Utility to return (prev, this, next) tuples from an iterator