code: def high_variance_confounds(
      series, n_confounds=5, percentile=2.0, detrend=True
  ):
      """Return confounds time series extracted from series \
      with highest variance.
  
      Parameters
      ----------
      series : :class:`numpy.ndarray`
          Timeseries. A timeseries is a column in the "series" array.
          shape (sample number, feature number)
  
      n_confounds : :obj:`int`, default=5
          Number of confounds to return.
  
      percentile : :obj:`float`, default=2.0
          Highest-variance series percentile to keep before computing the
          singular value decomposition, 0. <= `percentile` <= 100.
          ``series.shape[0] * percentile / 100`` must be greater
          than ``n_confounds``.
      %(detrend)s
          Default=True.
  
      Returns
      -------
      v : :class:`numpy.ndarray`
          Highest variance confounds. Shape: (samples, n_confounds)
  
      Notes
      -----
      This method is related to what has been published in the literature
      as 'CompCor' :footcite:p:`Behzadi2007`.
  
      The implemented algorithm does the following:
  
      - compute sum of squares for each time series (no mean removal)
      - keep a given percentile of series with highest variances (percentile)
      - compute an svd of the extracted series
      - return a given number (n_confounds) of series from the svd with
        highest singular values.
  
      References
      ----------
      .. footbibliography::
  
      See Also
      --------
      nilearn.image.high_variance_confounds
      """
      if detrend:
          series = _detrend(series)  # copy
  
      # Retrieve the voxels|features with highest variance
  
      # Compute variance without mean removal.
      var = _mean_of_squares(series)
      var_thr = np.nanpercentile(var, 100.0 - percentile)
      series = series[
          :, var > var_thr
      ]  # extract columns (i.e. features)
      # Return the singular vectors with largest singular values
      # We solve the symmetric eigenvalue problem here, increasing stability
      s, u = linalg.eigh(series.dot(series.T) / series.shape[0])
      ix_ = np.argsort(s)[::-1]
      u = u[:, ix_[:n_confounds]].copy()
      return u
  
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 7 for calling a global function with example usage: high_variance_confounds(series, n_confounds, percentile, detrend) and returns: u