code: def joint_superset_counts(pred, label):
      """
      Return TP if all label entities appear within pred entities
  
      :param pred, label: A joint group, represeted as a dict
      :return: A Counts namedtuple with TP, FP and FN counts
      """
      if pred["label"] != label["label"]:
          return Counts(0, 1, 1)
      for label_entity in label["entities"]:
          for pred_entity in pred["entities"]:
              if (
                  pred_entity["start"] <= label_entity["start"]
                  and pred_entity["end"] >= label_entity["end"]
                  and pred_entity["label"] == label_entity["label"]
              ):
                  break
          else:
              return Counts(0, 1, 1)
      return Counts(1, 0, 0)
  
imports: from copy import deepcopy
  from collections import namedtuple
  import numpy
  from scipy.optimize import linear_sum_assignment
  from finetune.util.metrics import _convert_to_token_list, _get_unique_classes, calc_precision, calc_recall, calc_f1
label_desc: Use image node_id 8 for calling a global function with example usage: joint_superset_counts(pred, label) and returns: Counts, Counts, Counts