code: def split_in_pairs(arg: Iterable) -> Iterable[Tuple]:
      
      # We are using zip_longest with one clever hack:
      # https://docs.python.org/3/library/itertools.html#itertools.zip_longest
      # We create an iterator out of the list and then pass the same iterator to
      # the function two times. Thus the function consumes a different element
      # from the iterator each time and produces the desired result.
      iterator = iter(arg)
      return zip_longest(iterator, iterator)
docs: Split given iterable in pairs [a, b, c, d, e] -> [(a, b), (c, d), (e, None)]