code: def create_joint_groups(outputs):
      """
      Given a list of NER and group outputs, create a list of joint groups. Joint
      groups are groups that contain entity information.
  
      :param outputs: A list of tuples, where each tuple is ([Doc A NER
      annotations, ...], [Doc A group annotations, ...])
      :returns joint_groups: A list of list of groups, where each groups has an
      additional "entities" key containing all entities that appear within the
      group
      """
      joint_groups = []
      for doc_entities, doc_groups in outputs:
          doc_joint_groups = attach_entities(doc_groups, doc_entities)
          joint_groups.append(doc_joint_groups)
      return joint_groups
  
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 20 for calling a global function with example usage: create_joint_groups(outputs) and returns: joint_groups