code: def _design_notch_peak_filter(w0, Q, ftype, fs=2.0):
      """
      Design notch or peak digital filter.
  
      Parameters
      ----------
      w0 : float
          Normalized frequency to remove from a signal. If `fs` is specified,
          this is in the same units as `fs`. By default, it is a normalized
          scalar that must satisfy  ``0 < w0 < 1``, with ``w0 = 1``
          corresponding to half of the sampling frequency.
      Q : float
          Quality factor. Dimensionless parameter that characterizes
          notch filter -3 dB bandwidth ``bw`` relative to its center
          frequency, ``Q = w0/bw``.
      ftype : str
          The type of IIR filter to design:
  
              - notch filter : ``notch``
              - peak filter  : ``peak``
      fs : float, optional
          The sampling frequency of the digital system.
  
      Returns
      -------
      b, a : ndarray, ndarray
          Numerator (``b``) and denominator (``a``) polynomials
          of the IIR filter.
      """
  
      # Guarantee that the inputs are floats
      w0 = float(w0)
      Q = float(Q)
      w0 = 2 * w0 / fs
  
      # Checks if w0 is within the range
      if w0 > 1.0 or w0 < 0.0:
          raise ValueError("w0 should be such that 0 < w0 < 1")
  
      # Get bandwidth
      bw = w0 / Q
  
      # Normalize inputs
      bw = bw * pi
      w0 = w0 * pi
  
      # Compute -3dB attenuation
      gb = 1 / math.sqrt(2)
  
      if ftype == "notch":
          # Compute beta: formula 11.3.4 (p.575) from reference [1]
          beta = (math.sqrt(1.0 - gb**2.0) / gb) * math.tan(bw / 2.0)
      elif ftype == "peak":
          # Compute beta: formula 11.3.19 (p.579) from reference [1]
          beta = (gb / math.sqrt(1.0 - gb**2.0)) * math.tan(bw / 2.0)
      else:
          raise ValueError("Unknown ftype.")
  
      # Compute gain: formula 11.3.6 (p.575) from reference [1]
      gain = 1.0 / (1.0 + beta)
  
      # Compute numerator b and denominator a
      # formulas 11.3.7 (p.575) and 11.3.21 (p.579)
      # from reference [1]
      if ftype == "notch":
          b = [gain * x for x in (1.0, -2.0 * math.cos(w0), 1.0)]
      else:
          b = [(1.0 - gain) * x for x in (1.0, 0.0, -1.0)]
  
      a = [1.0, -2.0 * gain * math.cos(w0), 2.0 * gain - 1.0]
  
      a = cupy.asarray(a)
      b = cupy.asarray(b)
  
      return b, a
  
file_path: cupy/cupyx/scipy/signal/_iir_filter_design.py
imports: from math import pi
  import math
  import cupy
  from cupyx.scipy.signal._iir_filter_conversions import lp2bp_zpk, lp2lp_zpk, lp2hp_zpk, lp2bs_zpk, bilinear_zpk, zpk2tf, zpk2sos
  from cupyx.scipy.signal._iir_filter_conversions import buttap, cheb1ap, cheb2ap, ellipap, buttord, ellipord, cheb1ord, cheb2ord, _validate_gpass_gstop
label_desc: Use image node_id 11 for calling a global function with example usage: _design_notch_peak_filter(w0, Q, ftype, fs) and returns: b,  a