code: def rolling_window(a, axis, window, center, fill_value):
      
      pads = [(0, 0) for s in a.shape]
      if center:
          start = int(window / 2)  # 10 -> 5,  9 -> 4
          end = window - 1 - start
          pads[axis] = (start, end)
      else:
          pads[axis] = (window - 1, 0)
      a = np.pad(a, pads, mode='constant', constant_values=fill_value)
      return _rolling_window(a, window, axis)
docs: rolling window with padding.