code: def condense_ner_labels(confusion, gold_labels, pred_labels):
      new_confusion = defaultdict(lambda: defaultdict(int))
      new_gold_labels = []
      new_pred_labels = []
      for l1 in gold_labels:
          if l1.find("-") >= 0:
              new_l1 = l1.split("-", 1)[1]
          else:
              new_l1 = l1
          if new_l1 not in new_gold_labels:
              new_gold_labels.append(new_l1)
          for l2 in pred_labels:
              if l2.find("-") >= 0:
                  new_l2 = l2.split("-", 1)[1]
              else:
                  new_l2 = l2
              if new_l2 not in new_pred_labels:
                  new_pred_labels.append(new_l2)
  
              old_value = confusion.get(l1, {}).get(l2, 0)
              new_confusion[new_l1][new_l2] = (
                  new_confusion[new_l1][new_l2] + old_value
              )
      return new_confusion, new_gold_labels, new_pred_labels
  
imports: from collections import defaultdict, namedtuple
label_desc: Use image node_id 1 for calling a global function with example usage: condense_ner_labels(confusion, gold_labels, pred_labels) and returns: new_confusion,  new_gold_labels,  new_pred_labels