code: def bilinear_zpk(z, p, k, fs):
      r"""
      Return a digital IIR filter from an analog one using a bilinear transform.
  
      Transform a set of poles and zeros from the analog s-plane to the digital
      z-plane using Tustin's method, which substitutes ``2*fs*(z-1) / (z+1)`` for
      ``s``, maintaining the shape of the frequency response.
  
      Parameters
      ----------
      z : array_like
          Zeros of the analog filter transfer function.
      p : array_like
          Poles of the analog filter transfer function.
      k : float
          System gain of the analog filter transfer function.
      fs : float
          Sample rate, as ordinary frequency (e.g., hertz). No prewarping is
          done in this function.
  
      Returns
      -------
      z : ndarray
          Zeros of the transformed digital filter transfer function.
      p : ndarray
          Poles of the transformed digital filter transfer function.
      k : float
          System gain of the transformed digital filter.
  
      See Also
      --------
      lp2lp_zpk, lp2hp_zpk, lp2bp_zpk, lp2bs_zpk
      bilinear
      scipy.signal.bilinear_zpk
  
      """
      z = cupy.atleast_1d(z)
      p = cupy.atleast_1d(p)
  
      degree = _relative_degree(z, p)
  
      fs2 = 2.0 * fs
  
      # Bilinear transform the poles and zeros
      z_z = (fs2 + z) / (fs2 - z)
      p_z = (fs2 + p) / (fs2 - p)
  
      # Any zeros that were at infinity get moved to the Nyquist frequency
      z_z = cupy.append(z_z, -cupy.ones(degree))
  
      # Compensate for gain change
      k_z = k * (cupy.prod(fs2 - z) / cupy.prod(fs2 - p)).real
  
      return z_z, p_z, k_z
  
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 10 for calling a global function with example usage: bilinear_zpk(z, p, k, fs) and returns: z_z,  p_z,  k_z