code: def pairwise(iterable):
      
      iterator = iter(iterable)
      try:
          first = next(iterator)
      except StopIteration:
          return
      for element in iterator:
          yield first, element
          first = element
docs: Generate consecutive pairs of elements from the given iterable.