code: def position_windows(pos, size, start, stop, step):
      
      last = False
  
      # determine start and stop positions
      if start is None:
          start = pos[0]
      if stop is None:
          stop = pos[-1]
      if step is None:
          # non-overlapping
          step = size
  
      windows = []
      for window_start in range(start, stop, step):
  
          # determine window stop
          window_stop = window_start + size
          if window_stop >= stop:
              # last window
              window_stop = stop
              last = True
          else:
              window_stop -= 1
  
          windows.append([window_start, window_stop])
  
          if last:
              break
  
      return np.asarray(windows)
docs: Convenience function to construct windows for the
      :func:`windowed_statistic` and :func:`windowed_count` functions.