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.
      """
  
      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 functools
  import logging
  import numbers
  import time
  import warnings
  from collections import Counter
  from contextlib import suppress
  from itertools import compress
  from traceback import format_exc
  import numpy
  import scipy.sparse
  from catboost import CatBoostClassifier, CatBoostRegressor
  from joblib import Parallel, logger
  from scipy.sparse import issparse
  from sklearn import config_context, get_config
  from sklearn.base import clone, is_classifier
  from sklearn.exceptions import FitFailedWarning, NotFittedError
  from sklearn.metrics import check_scoring
  from sklearn.metrics._scorer import _MultimetricScorer
  from sklearn.model_selection import check_cv
  from sklearn.utils.fixes import np_version, parse_version
  from sklearn.utils.validation import indexable
label_desc: Use image node_id 18 for calling a global function with example usage: _check_fit_params(X, fit_params, indices) and returns: fit_params_validated