code: def round_preserving_row_totals(confident_joint) -> np.ndarray:
      """Rounds confident_joint cj to type int
      while preserving the totals of reach row.
      Assumes that cj is a 2D np.ndarray of type float.
  
      Parameters
      ----------
      confident_joint : 2D np.ndarray<float> of shape (K, K)
          See compute_confident_joint docstring for details.
  
      Returns
      -------
      confident_joint : 2D np.ndarray<int> of shape (K,K)
          Rounded to int while preserving row totals."""
  
      return np.apply_along_axis(
          func1d=round_preserving_sum,
          axis=1,
          arr=confident_joint,
      ).astype(int)
  
imports: import warnings
  import numpy
  import pandas
  from typing import Union, Tuple
  from cleanlab.typing import DatasetLike, LabelLike
  from cleanlab.internal.validation import labels_to_array
  from cleanlab.internal.constants import FLOATING_POINT_COMPARISON, TINY_VALUE
label_desc: Use image node_id 8 for calling a global function with example usage: round_preserving_row_totals(confident_joint) and returns: np