code: def get_merged_dups(duplicates):
      def get_child_dups(path, dups_set=None):
          if dups_set is None:
              dups_set = set()
          dups_set.add(path)
          dups = duplicates[path]
          for dup in dups:
              if dup not in dups_set:
                  get_child_dups(dup, dups_set)
          return dups_set
  
      new_duplicates = {}
      for path in duplicates:
          path_dups = get_child_dups(path) - {path}
          new_duplicates[path] = [(x, -1) for x in path_dups]
      return new_duplicates
  
file_path: gluon-cv/gluoncv/torch/data/gluoncv_motion_dataset/ingestion/duplicate_remover.py
imports: import logging
  from pathlib import Path, PosixPath
  from collections import defaultdict
  import tqdm
  from ..dataset import GluonCVMotionDataset, get_vis_thumb_location
  from ..utils.ingestion_utils import get_chunked_id_map
label_desc: Use image node_id 5 for calling a global function with example usage: get_merged_dups(duplicates) and returns: new_duplicates, dups_set