code: def _validate_estimator(
      estimator: EstTypes, *valid_values: EstTypes
  ) -> Optional[bool]:
      # TODO: Add docstring
      for valid_value in valid_values:
          if (
              isinstance(valid_value, str)
              and estimator == valid_value.upper()
          ):
              return True
          if isinstance(valid_value, type) and isinstance(
              estimator, valid_value
          ):
              return True
  
      raise TypeError(
          f"Expected `base_estimator` in {valid_values}, not {estimator}"
      )
  
imports: from hyperparameter_hunter import __version__
  from hyperparameter_hunter.optimization.protocol_core import SKOptPro
  from hyperparameter_hunter.utils.version_utils import Deprecated
  from functools import partial
  from typing import Optional, Type, Union
  from sklearn.base import BaseEstimator
  from skopt.learning.gaussian_process.gpr import GaussianProcessRegressor
  from skopt.learning.gbrt import GradientBoostingQuantileRegressor
  from skopt.learning.forest import RandomForestRegressor, ExtraTreesRegressor
label_desc: Use image node_id 1 for calling a global function with example usage: _validate_estimator(estimator) and returns: True, True