code: def _replace_param_grid_key(param_grid, key_to_replace, new_key):
      """Replace a parameter name by another one.
  
      Parameters
      ----------
      param_grid : dict of str to sequence, or sequence of such
          The parameter grid to process, as a dictionary mapping estimator
          parameters to sequences of allowed values.
      key_to_replace : str
          Name of parameter to replace
      new_key : str
          New parameter name. If this key already exists in the parameter grid,
          it is overwritten
  
      Returns
      -------
      dict of str to sequence, or sequence of such
          The updated parameter grid
      """
      # ensure param_grid is a list so that we can loop over it
      input_is_dict = isinstance(param_grid, dict)
      if input_is_dict:
          param_grid = [param_grid]
  
      # replace old key by new key if needed
      new_param_grid = []
      for param_grid_item in param_grid:
          param_grid_item = dict(param_grid_item)  # make a new dict
          if key_to_replace in param_grid_item:
              warnings.warn(
                  f'The "{key_to_replace}" parameter in "param_grid" is'
                  f' being replaced by "{new_key}" due to a change in the'
                  " choice of underlying scikit-learn estimator. In a future"
                  " version, this will result in an error.",
                  DeprecationWarning,
                  stacklevel=13,
              )
              param_grid_item[new_key] = param_grid_item.pop(
                  key_to_replace
              )
          new_param_grid.append(param_grid_item)
  
      # return a dict if input was a dict
      if input_is_dict:
          new_param_grid = new_param_grid[0]
  
      return new_param_grid
  
imports: import itertools
  import warnings
  from typing import Iterable
  import numpy
  from joblib import Parallel, delayed
  from sklearn import clone
  from sklearn.base import BaseEstimator, MultiOutputMixin
  from sklearn.dummy import DummyClassifier, DummyRegressor
  from sklearn.linear_model import LassoCV, LogisticRegressionCV, RidgeClassifierCV, RidgeCV
  from sklearn.metrics import check_scoring, get_scorer
  from sklearn.model_selection import LeaveOneGroupOut, ParameterGrid, ShuffleSplit, StratifiedShuffleSplit, check_cv
  from sklearn.preprocessing import LabelBinarizer
  from sklearn.svm import SVR, LinearSVC, l1_min_c
  from sklearn.utils.extmath import safe_sparse_dot
  from sklearn.utils.validation import check_is_fitted, check_X_y
  from nilearn._utils import CacheMixin, fill_doc
  from nilearn._utils.cache_mixin import _check_memory
  from nilearn._utils.masker_validation import check_embedded_masker
  from nilearn._utils.param_validation import check_feature_screening
  from nilearn.experimental.surface import SurfaceMasker
  from nilearn.regions.rena_clustering import ReNA
label_desc: Use image node_id 4 for calling a global function with example usage: _replace_param_grid_key(param_grid, key_to_replace, new_key) and returns: new_param_grid