code: def _polycoeffs_from_zeros(zeros, tol=10):
      # a clone of numpy.poly, simplified
      dtyp = (
          cupy.complex_
          if cupy.issubdtype(zeros.dtype, cupy.complexfloating)
          else cupy.float_
      )
      a = cupy.ones(1, dtype=dtyp)
      for z in zeros:
          a = cupy.convolve(a, cupy.r_[1, -z], mode="full")
  
      # Use real output if possible.
      if dtyp == cupy.complex_:
          mask = cupy.abs(a.imag) < tol * cupy.finfo(a.dtype).eps
          a.imag[mask] = 0.0
          if mask.shape[0] == a.shape[0]:
              # all imag parts were fp noise
              a = a.real.copy()
          else:
              # if all cmplx roots are complex conj, the coefficients are real
              pos_roots = z[z.imag > 0]
              neg_roots = z[z.imag < 0]
              if pos_roots.shape[0] == neg_roots.shape[0]:
                  neg_roots = neg_roots.copy()
                  neg_roots.sort()
                  pos_roots = pos_roots.copy()
                  pos_roots.sort()
                  if (neg_roots == pos_roots.conj()).all():
                      a = a.real.copy()
      return a
  
imports: import warnings
  import math
  from math import pi, prod
  import cupy
  from cupyx.scipy.special import binom
  import cupyx.scipy.special
  from cupyx.scipy.signal import _optimize
  from cupyx.scipy.signal._polyutils import roots, poly
  from cupyx.scipy.signal._lti_conversion import abcd_normalize
label_desc: Use image node_id 3 for calling a global function with example usage: _polycoeffs_from_zeros(zeros, tol) and returns: a