code: def decompose(P):
      
      P = P.copy()
  
      if not P:
          return P
  
      out = [Poly({key:P.A[key]}) for key in P.keys]
      return Poly(out, None, None, None)
docs: Decompose a polynomial to component form.
  
      In array missing values are padded with 0 to make decomposition compatible
      with ``chaospy.sum(Q, 0)``.
  
      Args:
          P (Poly) : Input data.
  
      Returns:
          (Poly) : Decomposed polynomial with `P.shape==(M,)+Q.shape` where
                  `M` is the number of components in `P`.
  
      Examples:
          >>> q = cp.variable()
          >>> P = cp.Poly([q**2-1, 2])
          >>> print(P)
          [q0^2-1, 2]
          >>> print(cp.decompose(P))
          [[-1, 2], [q0^2, 0]]
          >>> print(cp.sum(cp.decompose(P), 0))
          [q0^2-1, 2]