code: def get_coco(split, img_split, year, mode):
      # To support ChainerMN, the target directory should be locked.
      with filelock.FileLock(
          os.path.join(
              download.get_dataset_directory("pfnet/chainercv/.lock"),
              "coco.lock",
          )
      ):
          data_dir = download.get_dataset_directory(root)
          annos_root = os.path.join(data_dir, "annotations")
          img_root = os.path.join(data_dir, "images")
          created_img_root = os.path.join(
              img_root, "{}{}".format(img_split, year)
          )
          img_url = img_urls[year][img_split]
          if mode == "instances":
              anno_url = instances_anno_urls[year][split]
              anno_path = os.path.join(
                  annos_root, "instances_{}{}.json".format(split, year)
              )
          elif mode == "panoptic":
              anno_url = panoptic_anno_url
              anno_path = os.path.join(
                  annos_root, "panoptic_{}{}.json".format(split, year)
              )
  
          if not os.path.exists(created_img_root):
              download_file_path = utils.cached_download(img_url)
              ext = os.path.splitext(img_url)[1]
              utils.extractall(download_file_path, img_root, ext)
          if not os.path.exists(anno_path):
              download_file_path = utils.cached_download(anno_url)
              ext = os.path.splitext(anno_url)[1]
              if split in ["train", "val"]:
                  utils.extractall(download_file_path, data_dir, ext)
              elif split in ["valminusminival", "minival"]:
                  utils.extractall(download_file_path, annos_root, ext)
  
          if mode == "panoptic":
              pixelmap_path = os.path.join(
                  annos_root, "panoptic_{}{}".format(split, year)
              )
              if not os.path.exists(pixelmap_path):
                  utils.extractall(
                      pixelmap_path + ".zip", annos_root, ".zip"
                  )
      return data_dir
  
imports: import filelock
  import os
  from chainer.dataset import download
  from chainercv import utils
label_desc: Use image node_id 1 for calling a global function with example usage: get_coco(split, img_split, year, mode) and returns: data_dir