code: def _check_filter_parameters(filter, low_pass, high_pass, t_r):
      """Check all filter related parameters are set correctly."""
      if not filter:
          if any(
              isinstance(item, float) for item in [low_pass, high_pass]
          ):
              warnings.warn(
                  "No filter type selected but cutoff frequency provided."
                  "Will not perform filtering."
              )
          return False
      elif filter in availiable_filters:
          if filter == "cosine" and not all(
              isinstance(item, float) for item in [t_r, high_pass]
          ):
              raise ValueError(
                  "Repetition time (t_r) and low cutoff frequency (high_pass) "
                  "must be specified for cosine "
                  f"filtering.t_r='{t_r}', high_pass='{high_pass}'"
              )
          if filter == "butterworth":
              if all(item is None for item in [low_pass, high_pass]):
                  # Butterworth was switched off by passing
                  # None to at least low_pass and high_pass
                  return False
              if t_r is None:
                  raise ValueError(
                      "Repetition time (t_r) must be specified for "
                      "butterworth filtering."
                  )
              if any(
                  isinstance(item, bool)
                  for item in [low_pass, high_pass]
              ):
                  raise TypeError(
                      "high/low pass must be float or None but you provided "
                      f"high_pass='{high_pass}', low_pass='{low_pass}'"
                  )
          return filter
      else:
          raise ValueError(f"Filter method {filter} not implemented.")
  
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 22 for calling a global function with example usage: _check_filter_parameters(filter, low_pass, high_pass, t_r) and returns: False, filter, False