code: def _check_cosine_by_user(confounds, cosine_drift):
      """Check if cosine term exists, based on correlation > 0.9."""
      # stack consine drift terms if there's no cosine drift term in data
      n_cosines = cosine_drift.shape[1]
  
      if n_cosines == 0:
          warnings.warn(
              "Cosine filter was not created. The time series might be too "
              "short or the high pass filter is not suitable for the data."
          )
          return confounds
  
      if confounds is None:
          return cosine_drift.copy()
  
      # check if cosine drift term is supplied by user
      # given the threshold and timeseries length, there can be no cosine drift
      # term
      corr_cosine = np.corrcoef(cosine_drift.T, confounds.T)
      np.fill_diagonal(corr_cosine, 0)
      cosine_exists = (
          sum(corr_cosine[:n_cosines, :].flatten() > 0.9) > 0
      )
  
      if cosine_exists:
          warnings.warn(
              "Cosine filter(s) exist in user supplied confounds."
              "Use user supplied regressors only."
          )
          return confounds
  
      return np.hstack((confounds, cosine_drift))
  
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 14 for calling a global function with example usage: _check_cosine_by_user(confounds, cosine_drift) and returns: np, confounds, cosine_drift, confounds