code: def _check_fit_params(X, fit_params, indices=None):
      """Check and validate the parameters passed during `fit`.
  
      Parameters
      ----------
      X : array-like of shape (n_samples, n_features)
          Data array.
  
      fit_params : dict
          Dictionary containing the parameters passed at fit.
  
      indices : array-like of shape (n_samples,), default=None
          Indices to be selected if the parameter has the same size as `X`.
  
      Returns
      -------
      fit_params_validated : dict
          Validated parameters. We ensure that the values support indexing.
      """
      from . import _safe_indexing
  
      fit_params_validated = {}
      for param_key, param_value in fit_params.items():
          if not _is_arraylike(param_value) or _num_samples(
              param_value
          ) != _num_samples(X):
              # Non-indexable pass-through (for now for backward-compatibility).
              # https://github.com/scikit-learn/scikit-learn/issues/15805
              fit_params_validated[param_key] = param_value
          else:
              # Any other fit_params should support indexing
              # (e.g. for cross-validation).
              fit_params_validated[param_key] = _make_indexable(
                  param_value
              )
              fit_params_validated[param_key] = _safe_indexing(
                  fit_params_validated[param_key], indices
              )
  
      return fit_params_validated
  
imports: import numbers
  import operator
  import warnings
  from contextlib import suppress
  from functools import reduce, wraps
  from inspect import Parameter, isclass, signature
  import joblib
  import numpy
  import scipy.sparse
  from ..None import get_config
  from ..exceptions import DataConversionWarning, NotFittedError, PositiveSpectrumWarning
  from ..utils._array_api import _asarray_with_order, _is_numpy_namespace, get_namespace
  from ..utils.fixes import ComplexWarning
  from ._isfinite import FiniteStatus, cy_isfinite
  from .fixes import _object_dtype_isnan
label_desc: Use image node_id 35 for calling a global function with example usage: _check_fit_params(X, fit_params, indices) and returns: fit_params_validated