code: def get_ckpt_path_from_folder(folder) -> str:
      ckpts = []
      allowed_ckpt_types = [
          f"*{ext}" for ext in ALLOWED_CHECKPOINT_EXTS
      ]
      for ckpt_type in allowed_ckpt_types:
          ckpts.extend(glob.glob(os.path.join(folder, ckpt_type)))
  
      assert (
          len(ckpts) == 1
      ), "None or multiple checkpoints files. MMF doesn't know what to do."
  
      return ckpts[0]
  
imports: import glob
  import importlib
  import logging
  import os
  import sys
  import warnings
  from typing import Any, Dict
  import torch
  from mmf.common.registry import registry
  from mmf.utils.checkpoint_updater import get_pretrained_state_mapping_checkpoint
  from mmf.utils.configuration import get_mmf_env, load_yaml
  from mmf.utils.distributed import is_main, is_xla, open_if_main, synchronize
  from mmf.utils.download import download_pretrained_model
  from mmf.utils.file_io import PathManager
  from mmf.utils.general import get_current_device, updir
  from mmf.utils.xla import save_xla_ckpt
  from omegaconf import OmegaConf
label_desc: Use image node_id 2 for calling a global function with example usage: get_ckpt_path_from_folder(folder) and returns: ckpts