code: def reshape(vari, shape):
      
  
      if isinstance(vari, Poly):
          core = vari.A.copy()
          for key in vari.keys:
              core[key] = reshape(core[key], shape)
          out = Poly(core, vari.dim, shape, vari.dtype)
          return out
  
      return numpy.asarray(vari).reshape(shape)
docs: Reshape the shape of a shapeable quantity.
  
      Args:
          vari (chaospy.poly.base.Poly, numpy.ndarray):
              Shapeable input quantity.
          shape (tuple):
              The polynomials new shape. Must be compatible with the number of
              elements in ``vari``.
  
      Returns:
          (chaospy.poly.base.Poly, numpy.ndarray):
              Same type as ``vari``.
  
      Examples:
          >>> poly = chaospy.prange(6)
          >>> print(poly)
          [1, q0, q0^2, q0^3, q0^4, q0^5]
          >>> print(chaospy.reshape(poly, (2,3)))
          [[1, q0, q0^2], [q0^3, q0^4, q0^5]]