code: def validate_labels(known_classes, passed_labels, argument_name):
      
      known_classes = np.array(known_classes)
      passed_labels = np.array(passed_labels)
  
      unique_labels, unique_indexes = np.unique(passed_labels, return_index=True)
  
      if len(passed_labels) != len(unique_labels):
          indexes = np.arange(0, len(passed_labels))
          duplicate_indexes = indexes[~np.in1d(indexes, unique_indexes)]
          duplicate_labels = [str(x) for x in passed_labels[duplicate_indexes]]
  
          msg = "The following duplicate labels were passed into {0}: {1}" \
                  .format(argument_name, ", ".join(duplicate_labels))
          raise ValueError(msg)
  
      passed_labels_absent = ~np.in1d(passed_labels, known_classes)
  
      if np.any(passed_labels_absent):
          absent_labels = [str(x) for x in passed_labels[passed_labels_absent]]
  
          msg = ("The following labels "
                 "were passed into {0}, "
                 "but were not found in "
                 "labels: {1}").format(argument_name, ", ".join(absent_labels))
          raise ValueError(msg)
  
      return
docs: Validates the labels passed into the true_labels or pred_labels
      arguments in the plot_confusion_matrix function.
  
      Raises a ValueError exception if any of the passed labels are not in the
      set of known classes or if there are duplicate labels. Otherwise returns
      None.
  
      Args:
          known_classes (array-like):
              The classes that are known to appear in the data.
          passed_labels (array-like):
              The labels that were passed in through the argument.
          argument_name (str):
              The name of the argument being validated.
  
      Example:
          >>> known_classes = ["A", "B", "C"]
          >>> passed_labels = ["A", "B"]
          >>> validate_labels(known_classes, passed_labels, "true_labels")