code: def sosfreqz(sos, worN=512, whole=False, fs=2 * pi):
      r"""
      Compute the frequency response of a digital filter in SOS format.
  
      Given `sos`, an array with shape (n, 6) of second order sections of
      a digital filter, compute the frequency response of the system function::
  
                 B0(z)   B1(z)         B{n-1}(z)
          H(z) = ----- * ----- * ... * ---------
                 A0(z)   A1(z)         A{n-1}(z)
  
      for z = exp(omega*1j), where B{k}(z) and A{k}(z) are numerator and
      denominator of the transfer function of the k-th second order section.
  
      Parameters
      ----------
      sos : array_like
          Array of second-order filter coefficients, must have shape
          ``(n_sections, 6)``. Each row corresponds to a second-order
          section, with the first three columns providing the numerator
          coefficients and the last three providing the denominator
          coefficients.
      worN : {None, int, array_like}, optional
          If a single integer, then compute at that many frequencies (default is
          N=512).  Using a number that is fast for FFT computations can result
          in faster computations (see Notes of `freqz`).
  
          If an array_like, compute the response at the frequencies given (must
          be 1-D). These are in the same units as `fs`.
      whole : bool, optional
          Normally, frequencies are computed from 0 to the Nyquist frequency,
          fs/2 (upper-half of unit-circle). If `whole` is True, compute
          frequencies from 0 to fs.
      fs : float, optional
          The sampling frequency of the digital system. Defaults to 2*pi
          radians/sample (so w is from 0 to pi).
  
          .. versionadded:: 1.2.0
  
      Returns
      -------
      w : ndarray
          The frequencies at which `h` was computed, in the same units as `fs`.
          By default, `w` is normalized to the range [0, pi) (radians/sample).
      h : ndarray
          The frequency response, as complex numbers.
  
      See Also
      --------
      freqz, sosfilt
      scipy.signal.sosfreqz
      """
      sos, n_sections = _validate_sos(sos)
      if n_sections == 0:
          raise ValueError(
              "Cannot compute frequencies with no sections"
          )
      h = 1.0
      for row in sos:
          w, rowh = freqz(
              row[:3], row[3:], worN=worN, whole=whole, fs=fs
          )
          h *= rowh
      return w, h
  
imports: import operator
  from math import pi
  import warnings
  import cupy
  from cupy.polynomial.polynomial import polyval, polyvalfromroots
  import cupyx.scipy.fft
  from cupyx import jit
  from cupyx.scipy._lib._util import float_factorial
  from cupyx.scipy.signal._polyutils import roots
label_desc: Use image node_id 10 for calling a global function with example usage: sosfreqz(sos, worN, whole, fs) and returns: w,  h