code: def cumsum(vari, axis=None):
      
      if isinstance(vari, Poly):
          core = vari.A.copy()
          for key, val in core.items():
              core[key] = cumsum(val, axis)
          return Poly(core, vari.dim, None, vari.dtype)
  
      return np.cumsum(vari, axis)
docs: Cumulative sum the components of a shapeable quantity along a given axis.
  
      Args:
          vari (chaospy.poly.base.Poly, numpy.ndarray):
              Input data.
          axis (int):
              Axis over which the sum is taken. By default ``axis`` is None, and
              all elements are summed.
  
      Returns:
          (chaospy.poly.base.Poly, numpy.ndarray):
              Polynomial array with same shape as ``vari``.
  
      Examples:
          >>> poly = cp.prange(3)
          >>> print(poly)
          [1, q0, q0^2]
          >>> print(cp.cumsum(poly))
          [1, q0+1, q0^2+q0+1]