code: def get_coco_api_from_dataset(dataset):
      for _ in range(10):
          # if isinstance(dataset, torchvision.datasets.CocoDetection):
          #     break
          if isinstance(dataset, torch.utils.data.Subset):
              dataset = dataset.dataset
      if isinstance(dataset, torchvision.datasets.CocoDetection):
          return dataset.coco
  
imports: import torch.utils.data
  import torchvision
  from .coco import build
label_desc: Use image node_id 1 for calling a global function with example usage: get_coco_api_from_dataset(dataset) and returns: dataset