code: def flatten(sorted_groups, sorted_bbox_groups):
      idxs = []
      bboxes = []
      for group, bbox_group in zip(sorted_groups, sorted_bbox_groups):
          for g, bg in zip(group, bbox_group):
              idxs.append(g)
              bboxes.append(bg)
      return idxs, bboxes
  
imports: import os
  import re
  import cv2
  import glob
  import copy
  import math
  import pickle
  import numpy
  from shapely.geometry import Polygon, MultiPoint
label_desc: Use image node_id 12 for calling a global function with example usage: flatten(sorted_groups, sorted_bbox_groups) and returns: idxs,  bboxes