code: def _mean_of_squares(signals, n_batches=20):
      """Compute mean of squares for each signal.
  
      This function is equivalent to:
  
      .. code-block:: python
  
          var = np.copy(signals)
          var **= 2
          var = var.mean(axis=0)
  
      but uses a lot less memory.
  
      Parameters
      ----------
      signals : :class:`numpy.ndarray`, shape (n_samples, n_features)
          Signal whose mean of squares must be computed.
  
      n_batches : :obj:`int`, default=20
          Number of batches to use in the computation.
  
          .. note::
              Tweaking this value can lead to variation of memory usage
              and computation time. The higher the value, the lower the
              memory consumption.
  
  
      Returns
      -------
      var : :class:`numpy.ndarray`
          1D array holding the mean of squares.
      """
      # No batching for small arrays
      if signals.shape[1] < 500:
          n_batches = 1
  
      # Fastest for C order
      var = np.empty(signals.shape[1])
      for batch in gen_even_slices(signals.shape[1], n_batches):
          tvar = np.copy(signals[:, batch])
          tvar **= 2
          var[batch] = tvar.mean(axis=0)
  
      return var
  
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 2 for calling a global function with example usage: _mean_of_squares(signals, n_batches) and returns: var