code: def get_ordered_classes(classes, true_y, pred_y):
      """Get the ordered classes for the given true and predicted labels.
  
      :param classes: List of classes.
      :type classes: list
      :param true_y: True labels.
      :type true_y: numpy.ndarray
      :param pred_y: Predicted labels.
      :type pred_y: numpy.ndarray
      :return: Ordered classes.
      :rtype: list
      """
      # If classes is none, or disagrees with labels from true and predicted
      # arrays, return the sorted set of labels.
      # Otherwise return classes as it provides the correct ordering and any
      # classes we may be missing for the subset of data evaluated.
      labels = list(set(true_y) | set(pred_y))
      labels.sort()
      if classes is None:
          return labels
      for label in labels:
          if label not in classes:
              return labels
      return classes
  
file_path: responsible-ai-toolbox/erroranalysis/erroranalysis/_internal/metrics.py
imports: import numpy
  from sklearn.metrics import accuracy_score, confusion_matrix, f1_score, mean_absolute_error, mean_squared_error, median_absolute_error, precision_score, r2_score, recall_score
  from erroranalysis._internal.constants import Metrics, ModelTask, f1_metrics, precision_metrics, recall_metrics
label_desc: Use image node_id 13 for calling a global function with example usage: get_ordered_classes(classes, true_y, pred_y) and returns: classes, labels, labels