code: def _create_text_labels(
      classes, scores, class_names, ground_truth=False
  ):
      """
      Create text labels.
      Args:
          classes (list[int]): a list of class ids for each example.
          scores (list[float] or None): list of scores for each example.
          class_names (list[str]): a list of class names, ordered by their ids.
          ground_truth (bool): whether the labels are ground truth.
      Returns:
          labels (list[str]): formatted text labels.
      """
      try:
          labels = [class_names[i] for i in classes]
      except IndexError:
          logger.error(
              "Class indices get out of range: {}".format(classes)
          )
          return None
  
      if ground_truth:
          labels = ["[{}] {}".format("GT", label) for label in labels]
      elif scores is not None:
          assert len(classes) == len(scores)
          labels = [
              "[{:.2f}] {}".format(s, label)
              for s, label in zip(scores, labels)
          ]
      return labels
  
imports: import itertools
  import logging
  import numpy
  import matplotlib.pyplot
  import torch
  from detectron2.utils.visualizer import Visualizer
  import slowfast.utils.logging
  from slowfast.utils.misc import get_class_names
label_desc: Use image node_id 1 for calling a global function with example usage: _create_text_labels(classes, scores, class_names, ground_truth) and returns: labels, None