code: def _check_wn(btype, freq, nyq):
      """Ensure that the critical frequency works with the Nyquist frequency.
  
      The critical frequency must be (1) >= 0 and (2) < Nyquist.
      When critical frequencies are exactly at the Nyquist frequency,
      results are unstable.
  
      See issue at SciPy https://github.com/scipy/scipy/issues/6265.
      Due to unstable results as pointed in the issue above,
      we force the critical frequencies to be slightly less than the Nyquist
      frequency, and slightly more than zero.
      """
      if freq >= nyq:
          freq = nyq - (nyq * 10 * np.finfo(1.0).eps)
          warnings.warn(
              f"The frequency specified for the {btype} pass filter is "
              "too high to be handled by a digital filter "
              "(superior to Nyquist frequency). "
              f"It has been lowered to {freq} (Nyquist frequency)."
          )
  
      elif freq < 0.0:  # equal to 0.0 is okay
          freq = nyq * np.finfo(1.0).eps
          warnings.warn(
              f"The frequency specified for the {btype} pass filter is too "
              "low to be handled by a digital filter (must be non-negative). "
              f"It has been set to eps: {freq}"
          )
  
      return freq
  
imports: import warnings
  import numpy
  import pandas
  from scipy import linalg, signal
  from scipy.interpolate import CubicSpline
  from sklearn.utils import as_float_array, gen_even_slices
  from nilearn._utils import fill_doc, stringify_path
  from nilearn._utils.numpy_conversions import as_ndarray, csv_to_array
  from nilearn._utils.param_validation import check_run_sample_masks
label_desc: Use image node_id 5 for calling a global function with example usage: _check_wn(btype, freq, nyq) and returns: freq