code: def prune(A, threshold):
      
      if isinstance(A, Poly):
          B = A.A.copy()
          for key in A.keys:
              values = B[key].copy()
              values[numpy.abs(values) < threshold] = 0.
              B[key] = values
          return Poly(B, A.dim, A.shape, A.dtype)
  
      A = A.copy()
      A[numpy.abs(A) < threshold] = 0.
      return A
docs: Remove coefficients that is not larger than a given threshold.
  
      Args:
          A (Poly):
              Input data.
          threshold (float):
              Threshold for which values to cut.
  
      Returns:
          (Poly):
              Same type as A.
  
      Examples:
          >>> P = chaospy.sum(chaospy.prange(3)*2**-numpy.arange(0, 6, 2, float))
          >>> print(P)
          0.0625q0^2+0.25q0+1.0
          >>> print(chaospy.prune(P, 0.1))
          0.25q0+1.0
          >>> print(chaospy.prune(P, 0.5))
          1.0
          >>> print(chaospy.prune(P, 1.5))
          0.0