code: def _rescale_data(X, y, sample_weight):
      """Rescale data sample-wise by square root of sample_weight.
  
      For many linear models, this enables easy support for sample_weight.
  
      Returns
      -------
      X_rescaled : {array-like, sparse matrix}
  
      y_rescaled : {array-like, sparse matrix}
      """
      n_samples = X.shape[0]
      sample_weight = mt.asarray(sample_weight)
      if sample_weight.ndim == 0:
          sample_weight = mt.full(
              n_samples, sample_weight, dtype=sample_weight.dtype
          )
      sample_weight = mt.sqrt(sample_weight)
      sw_matrix = mt.diag(sample_weight, sparse=True)
      X = mt.dot(sw_matrix, X)
      y = mt.dot(sw_matrix, y)
      return X, y
  
imports: import numbers
  from abc import ABCMeta, abstractmethod
  from numpy.linalg import LinAlgError
  from sklearn.utils.validation import check_is_fitted, _deprecate_positional_args
  from sklearn.base import MultiOutputMixin
  from ...None import execute
  from ...None import tensor
  from ...tensor.datasource import tensor
  from ..base import BaseEstimator, RegressorMixin, ClassifierMixin
  from ..preprocessing import normalize
  from ..utils.validation import _check_sample_weight, check_array, FLOAT_DTYPES
label_desc: Use image node_id 2 for calling a global function with example usage: _rescale_data(X, y, sample_weight) and returns: X,  y