code: def transpose(vari):
      
      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)
docs: 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:
          >>> P = chaospy.reshape(chaospy.prange(4), (2,2))
          >>> print(P)
          [[1, q0], [q0^2, q0^3]]
          >>> print(chaospy.transpose(P))
          [[1, q0^2], [q0, q0^3]]