code: def pairwise(iterable):
      "s -> (s0,s1), (s1,s2), (s2, s3), ..."
      now, nxt = tee(iterable)
      next(nxt, None)
      return izip(now, nxtf pairwise(iterable):
      "s -> (s0,s1), (s1,s2), (s2, s3), ..."
      now, nxt = tee(iterable)
      next(nxt, None)
      return izip(now, nxt)
docs: s -> (s0,s1), (s1,s2), (s2, s3), ...