code: def _check_normalize_sample_weight(sample_weight, X):
      """Set sample_weight if None, and check for correct dtype"""
  
      sample_weight_was_none = sample_weight is None
  
      sample_weight = _check_sample_weight(
          sample_weight, X, dtype=X.dtype
      )
      if not sample_weight_was_none:
          # normalize the weights to sum up to n_samples
          # an array of 1 (i.e. samples_weight is None) is already normalized
          n_samples = len(sample_weight)
          scale = n_samples / sample_weight.sum()
          sample_weight *= scale
      return sample_weight
  
imports: import warnings
  import numpy
  from sklearn.base import ClusterMixin, TransformerMixin
  from sklearn.exceptions import ConvergenceWarning
  from ...None import tensor
  from ...tensor.utils import check_random_state
  from ..base import BaseEstimator
  from ..metrics.pairwise import euclidean_distances
  from ..utils.extmath import row_norms
  from ..utils.validation import _check_sample_weight, check_array, _num_samples, check_is_fitted
  from ._k_means_common import _inertia
  from ._k_means_elkan_iter import init_bounds, elkan_iter
  from ._k_means_init import _k_init, _scalable_k_init
  from ._k_means_lloyd_iter import lloyd_iter
label_desc: Use image node_id 3 for calling a global function with example usage: _check_normalize_sample_weight(sample_weight, X) and returns: sample_weight