code: def _get_single_annotator_worst_class(
      labels: np.ndarray,
      consensus_label: np.ndarray,
      consensus_quality_score: np.ndarray,
  ) -> int:
      """Returns the class a given annotator makes the most errors in.
  
      Parameters
      ----------
      labels : np.ndarray
          An array of shape ``(N,)`` with the labels from the annotator we want to evaluate.
      consensus_label : np.ndarray
          An array of shape ``(N,)`` with the consensus labels aggregated from all annotators.
      consensus_quality_score : np.ndarray
          An array of shape ``(N,)`` with the quality score of the consensus.
  
      Returns
      -------
      worst_class : int
          The class that is most frequently mislabeled by the given annotator.
      """
      labels = pd.Series(labels)
      labels_mask = pd.notna(labels)
      class_accuracies = (
          (labels[labels_mask] == consensus_label[labels_mask])
          .groupby(labels)
          .mean()
      )
      accuracy_min_idx = class_accuracies[
          class_accuracies == class_accuracies.min()
      ].index.values
  
      if len(accuracy_min_idx) == 1:
          return accuracy_min_idx[0]
  
      # tiebreak 1: class counts
      class_count = (
          labels[labels_mask].groupby(labels).count()[accuracy_min_idx]
      )
      count_max_idx = class_count[
          class_count == class_count.max()
      ].index.values
  
      if len(count_max_idx) == 1:
          return count_max_idx[0]
  
      # tiebreak 2: consensus quality scores
      avg_consensus_quality = (
          pd.DataFrame(
              {
                  "annotator_label": labels,
                  "consensus_quality_score": consensus_quality_score,
              }
          )[labels_mask]
          .groupby("annotator_label")
          .mean()["consensus_quality_score"][count_max_idx]
      )
      quality_max_idx = avg_consensus_quality[
          avg_consensus_quality == avg_consensus_quality.max()
      ].index.values
  
      # return first item even if there are ties - no better methods to tiebreak
      return quality_max_idx[0]
  
imports: import warnings
  import numpy
  import pandas
  from typing import List, Dict, Any, Union, Tuple, Optional
  from cleanlab.rank import get_label_quality_scores
  from cleanlab.internal.util import get_num_classes, value_counts
  from cleanlab.internal.constants import CLIPPING_LOWER_BOUND
  from cleanlab.internal.multiannotator_utils import assert_valid_inputs_multiannotator, assert_valid_pred_probs, check_consensus_label_classes, find_best_temp_scaler, temp_scale_pred_probs
label_desc: Use image node_id 18 for calling a global function with example usage: _get_single_annotator_worst_class(labels, consensus_label, consensus_quality_score) and returns: quality_max_idx, accuracy_min_idx, count_max_idx