code: def group_overlap_counts(pred, label):
      """
      Return TP if groups overlap at all
  
      :param pred, label: A 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 pred_span in pred["spans"]:
          for label_span in label["spans"]:
              start = max(pred_span["start"], label_span["start"])
              end = min(pred_span["end"], label_span["end"])
              # If overlapping...
              if start < end:
                  return Counts(1, 0, 0)
      return Counts(0, 1, 1)
  
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 3 for calling a global function with example usage: group_overlap_counts(pred, label) and returns: Counts, Counts, Counts