code: def _get_num_examples(
      labels=None, confident_joint: Optional[np.ndarray] = None
  ) -> int:
      """Helper method that finds the number of examples from the parameters or throws an error
      if neither parameter is provided.
  
      **Parameters:** For information about the arguments to this method, see the documentation of `dataset.find_overlapping_classes`
  
      Returns
      -------
      num_examples : int
          The number of examples in the dataset.
  
      Raises
      ------
      ValueError
          If `labels` is None."""
  
      if labels is None and confident_joint is None:
          raise ValueError(
              "Error: num_examples is None. You must either provide confident_joint, "
              "or provide both num_example and joint as input parameters."
          )
      _confident_joint = cast(np.ndarray, confident_joint)
      num_examples = (
          len(labels)
          if labels is not None
          else cast(int, np.sum(_confident_joint))
      )
      return num_examples
  
file_path: cleanlab/cleanlab/dataset.py
imports: from typing import Optional, cast
  import numpy
  import pandas
  from cleanlab.count import estimate_joint, num_label_issues
label_desc: Use image node_id 5 for calling a global function with example usage: _get_num_examples(labels, confident_joint) and returns: num_examples