code: def iterintervals(self, n=2):
          
          # tee the original iterator into n identical iterators
          streams = tee(iter(self), n)
  
          # advance the "cursor" on each iterator by an increasing
          # offset, e.g. if n=3:
          #
          #                   [a, b, c, d, e, f, ..., w, x, y, z]
          #  first cursor -->  *
          # second cursor -->     *
          #  third cursor -->        *
          for stream_index, stream in enumerate(streams):
              for i in range(stream_index):
                  next(stream)
  
          # now, zip the offset streams back together to yield tuples,
          # in the n=3 example it would yield:
          # (a, b, c), (b, c, d), ..., (w, x, y), (x, y, z)
          for intervals in zip(*streams):
              yield intervals
docs: Iterate over groups of `n` consecutive measurement points in the
          time series.