<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def cumsum(vari, axis=None):
 """ 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: [1, q0, q0^2] [1, q0+1, q0^2+q0+1] """

    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)