code: def _check_estimator(estimator):
      if not isinstance(estimator, str):
          warnings.warn(
              "Use a custom estimator at your own risk "
              "of the process not working as intended."
          )
      elif estimator in SUPPORTED_ESTIMATORS.keys():
          estimator = SUPPORTED_ESTIMATORS.get(estimator)
      else:
          raise ValueError(
              "Invalid estimator. Known estimators are: "
              f"{list(SUPPORTED_ESTIMATORS.keys())}"
          )
  
      return estimator
  
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 5 for calling a global function with example usage: _check_estimator(estimator) and returns: estimator