<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def transpose(vari):
 """ Transpose a shapeable quantety. Args: vari (chaospy.poly.base.Poly, numpy.ndarray):
 Quantety of interest. Returns: (chaospy.poly.base.Poly, numpy.ndarray):
 Same type as ``vari``. Examples: [[1, q0], [q0^2, q0^3]] [[1, q0^2], [q0, q0^3]] """

    if isinstance(vari, Poly):
        core = vari.A.copy()
        for key in vari.keys:
            core[key] = transpose(core[key])
        return Poly(core, vari.dim, vari.shape[::-1], vari.dtype)

    return numpy.transpose(vari)