code: def with_sample_weight(clf, sample_weight, fit_params):
      """
      Return fit_params with added "sample_weight" argument.
      Unlike `fit_params['sample_weight'] = sample_weight` it
      handles a case where ``clf`` is a pipeline.
      """
      param_name = _get_classifier_prefix(clf) + "sample_weight"
      params = {param_name: sample_weight}
      params.update(fit_params)
      return params
  
imports: from __future__ import absolute_import
  from typing import List, Any
  import numpy
  from scipy.stats import entropy
  from sklearn.pipeline import Pipeline
  from sklearn.utils import check_random_state, issparse
  from sklearn.utils.metaestimators import if_delegate_has_method
  from sklearn.utils import shuffle
  from eli5.utils import vstack
  from eli5.sklearn.utils import sklearn_version
label_desc: Use image node_id 2 for calling a global function with example usage: with_sample_weight(clf, sample_weight, fit_params) and returns: params