code: def _weights_scorer(scorer, estimator, X, y, sample_weight):
      if sample_weight is not None:
          return scorer(estimator, X, y, sample_weight=sample_weight)
      return scorer(estimator, X, y)
  
file_path: catboost/contrib/python/scikit-learn/py3/sklearn/inspection/_permutation_importance.py
imports: import numbers
  import numpy
  from ..ensemble._bagging import _generate_indices
  from ..metrics import check_scoring, get_scorer_names
  from ..metrics._scorer import _check_multimetric_scoring, _MultimetricScorer
  from ..model_selection._validation import _aggregate_score_dicts
  from ..utils import Bunch, _safe_indexing, check_array, check_random_state
  from ..utils._param_validation import HasMethods, Integral, Interval, RealNotInt, StrOptions, validate_params
  from ..utils.parallel import Parallel, delayed
label_desc: Use image node_id 1 for calling a global function with example usage: _weights_scorer(scorer, estimator, X, y, sample_weight) and returns: scorer, scorer