code: def _preprocess_data(
      X,
      y,
      fit_intercept,
      normalize=False,
      copy=True,
      sample_weight=None,
      return_mean=False,
      check_input=True,
  ):
      """Center and scale data.
  
      Centers data to have mean zero along axis 0. If fit_intercept=False or if
      the X is a sparse matrix, no centering is done, but normalization can still
      be applied. The function returns the statistics necessary to reconstruct
      the input data, which are X_offset, y_offset, X_scale, such that the output
  
          X = (X - X_offset) / X_scale
  
      X_scale is the L2 norm of X - X_offset. If sample_weight is not None,
      then the weighted mean of X and y is zero, and not the mean itself. If
      return_mean=True, the mean, eventually weighted, is returned, independently
      of whether X was centered (option used for optimization with sparse data in
      coordinate_descend).
  
      This is here because nearly all linear models will want their data to be
      centered. This function also systematically makes y consistent with X.dtype
      """
      if isinstance(sample_weight, numbers.Number):
          sample_weight = None
      if sample_weight is not None:
          sample_weight = astensor(sample_weight)
  
      X = astensor(X)
      y = astensor(y, dtype=X.dtype)
  
      if check_input:
          X = check_array(
              X,
              copy=copy,
              accept_sparse=["csr", "csc"],
              dtype=FLOAT_DTYPES,
          )
      elif copy:
          if X.issparse():
              X = X.copy()
          else:
              X = X.copy(order="K")
  
      if fit_intercept:
          if X.issparse():
              raise NotImplementedError(
                  "Does not support sparse input!"
              )
          else:
              X_offset = mt.average(X, axis=0, weights=sample_weight)
              X = X - X_offset
              if normalize:
                  X, X_scale = f_normalize(
                      X, axis=0, copy=False, return_norm=True
                  )
              else:
                  X_scale = mt.ones(X.shape[1], dtype=X.dtype)
          y_offset = mt.average(y, axis=0, weights=sample_weight)
          y = y - y_offset
      else:
          if X.issparse():
              raise NotImplementedError(
                  "Does not support sparse input!"
              )
          X_offset = mt.zeros(X.shape[1], dtype=X.dtype)
          X_scale = mt.ones(X.shape[1], dtype=X.dtype)
          if y.ndim == 1:
              y_offset = X.dtype.type(0)
          else:
              y_offset = mt.zeros(y.shape[1], dtype=X.dtype)
  
      return X, y, X_offset, y_offset, X_scale
  
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 1 for calling a global function with example usage: _preprocess_data(X, y, fit_intercept, normalize, copy, sample_weight, return_mean, check_input) and returns: X,  y,  X_offset,  y_offset,  X_scale