code: def butter(N, Wn, btype="low", analog=False, output="ba", fs=None):
      """
      Butterworth digital and analog filter design.
  
      Design an Nth-order digital or analog Butterworth filter and return
      the filter coefficients.
  
      Parameters
      ----------
      N : int
          The order of the filter. For 'bandpass' and 'bandstop' filters,
          the resulting order of the final second-order sections ('sos')
          matrix is ``2*N``, with `N` the number of biquad sections
          of the desired system.
      Wn : array_like
          The critical frequency or frequencies. For lowpass and highpass
          filters, Wn is a scalar; for bandpass and bandstop filters,
          Wn is a length-2 sequence.
  
          For a Butterworth filter, this is the point at which the gain
          drops to 1/sqrt(2) that of the passband (the "-3 dB point").
  
          For digital filters, if `fs` is not specified, `Wn` units are
          normalized from 0 to 1, where 1 is the Nyquist frequency (`Wn` is
          thus in half cycles / sample and defined as 2*critical frequencies
          / `fs`). If `fs` is specified, `Wn` is in the same units as `fs`.
  
          For analog filters, `Wn` is an angular frequency (e.g. rad/s).
      btype : {'lowpass', 'highpass', 'bandpass', 'bandstop'}, optional
          The type of filter.  Default is 'lowpass'.
      analog : bool, optional
          When True, return an analog filter, otherwise a digital filter is
          returned.
      output : {'ba', 'zpk', 'sos'}, optional
          Type of output:  numerator/denominator ('ba'), pole-zero ('zpk'), or
          second-order sections ('sos'). Default is 'ba' for backwards
          compatibility, but 'sos' should be used for general-purpose filtering.
      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.
          Only returned if ``output='ba'``.
      z, p, k : ndarray, ndarray, float
          Zeros, poles, and system gain of the IIR filter transfer
          function.  Only returned if ``output='zpk'``.
      sos : ndarray
          Second-order sections representation of the IIR filter.
          Only returned if ``output='sos'``.
  
      See Also
      --------
      buttord, buttap
      iirfilter
      scipy.signal.butter
  
  
      Notes
      -----
      The Butterworth filter has maximally flat frequency response in the
      passband.
  
      If the transfer function form ``[b, a]`` is requested, numerical
      problems can occur since the conversion between roots and
      the polynomial coefficients is a numerically sensitive operation,
      even for N >= 4. It is recommended to work with the SOS
      representation.
  
      .. warning::
          Designing high-order and narrowband IIR filters in TF form can
          result in unstable or incorrect filtering due to floating point
          numerical precision issues. Consider inspecting output filter
          characteristics `freqz` or designing the filters with second-order
          sections via ``output='sos'``.
      """
      return iirfilter(
          N,
          Wn,
          btype=btype,
          analog=analog,
          output=output,
          ftype="butter",
          fs=fs,
      )
  
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 3 for calling a global function with example usage: butter(N, Wn, btype, analog, output, fs) and returns: iirfilter