code: def _prune_by_count(args: list) -> np.ndarray:
      """multiprocessing Helper function for find_label_issues() that assumes
      globals and produces a mask for class k for each example by
      removing the example with noisy label k having *largest margin*,
      where
      margin of example := prob of given label - max prob of non-given labels
  
      Parameters
      ----------
      k : int (between 0 and num classes - 1)
        The true_label class of interest."""
  
      k, min_examples_per_class, arrays = args
      if arrays is None:
          pred_probs = pred_probs_by_class[k]
          prune_count_matrix = prune_count_matrix_cols[k]
      else:
          pred_probs = arrays[0]
          prune_count_matrix = arrays[1]
  
      label_counts = pred_probs.shape[0]
      label_issues_mask = np.zeros(label_counts, dtype=bool)
      if label_counts <= min_examples_per_class:
          warnings.warn(
              f"May not flag all label issues in class: {k}, it has too few examples (see `min_examples_per_class` argument)"
          )
          return label_issues_mask
  
      K = pred_probs.shape[1]
      if K < 1:
          raise ValueError("Must have at least 1 class.")
      for j in range(K):
          num2prune = prune_count_matrix[j]
          # Only prune for noise rates, not diagonal entries
          if k != j and num2prune > 0:
              # num2prune's largest p(true class k) - p(noisy class k)
              # for x with true label j
              margin = pred_probs[:, j] - pred_probs[:, k]
              order = np.argsort(-margin)
              label_issues_mask[order[:num2prune]] = True
      return label_issues_mask
  
imports: import numpy
  from sklearn.metrics import confusion_matrix
  import multiprocessing
  import sys
  import warnings
  from typing import Any, Dict, Optional, Tuple, List
  from functools import reduce
  import platform
  from cleanlab.count import calibrate_confident_joint, num_label_issues, _reduce_issues
  from cleanlab.rank import order_label_issues, get_label_quality_scores
  import cleanlab.internal.multilabel_scorer
  from cleanlab.internal.validation import assert_valid_inputs
  from cleanlab.internal.util import value_counts_fill_missing_classes, round_preserving_row_totals, get_num_classes
  from cleanlab.internal.multilabel_utils import stack_complement, get_onehot_num_classes, int2onehot
  from cleanlab.typing import LabelLike
  from cleanlab.multilabel_classification.filter import find_multilabel_issues_per_class
label_desc: Use image node_id 12 for calling a global function with example usage: _prune_by_count(args) and returns: label_issues_mask, label_issues_mask