code: def _bistochastic_normalize(X, max_iter=1000, tol=1e-5):
      """Normalize rows and columns of ``X`` simultaneously so that all
      rows sum to one constant and all columns sum to a different
      constant.
      """
      # According to paper, this can also be done more efficiently with
      # deviation reduction and balancing algorithms.
      X = make_nonnegative(X)
      X_scaled = X
      for _ in range(max_iter):
          X_new, _, _ = _scale_normalize(X_scaled)
          if issparse(X):
              dist = norm(X_scaled.data - X.data)
          else:
              dist = norm(X_scaled - X_new)
          X_scaled = X_new
          if dist is not None and dist < tol:
              break
      return X_scaled
  
imports: from abc import ABCMeta, abstractmethod
  from numbers import Integral
  import numpy
  from scipy.linalg import norm
  from scipy.sparse import dia_matrix, issparse
  from scipy.sparse.linalg import eigsh, svds
  from ..base import BaseEstimator, BiclusterMixin, _fit_context
  from ..utils import check_random_state, check_scalar
  from ..utils._param_validation import Interval, StrOptions
  from ..utils.extmath import make_nonnegative, randomized_svd, safe_sparse_dot
  from ..utils.validation import assert_all_finite
  from ._kmeans import KMeans, MiniBatchKMeans
label_desc: Use image node_id 2 for calling a global function with example usage: _bistochastic_normalize(X, max_iter, tol) and returns: X_scaled