code: def _try_get_key(cfg, *keys, default=None):
      """
      Try select keys from cfg until the first key that exists. Otherwise return default.
      """
      if isinstance(cfg, CfgNode):
          cfg = OmegaConf.create(cfg.dump())
      for k in keys:
          none = object()
          p = OmegaConf.select(cfg, k, default=none)
          if p is not none:
              return p
      return default
  
imports: import argparse
  import logging
  import os
  import sys
  import weakref
  from collections import OrderedDict
  from typing import Optional
  import torch
  from fvcore.nn.precise_bn import get_bn_modules
  from omegaconf import OmegaConf
  from torch.nn.parallel import DistributedDataParallel
  import detectron2.data.transforms
  from detectron2.checkpoint import DetectionCheckpointer
  from detectron2.config import CfgNode, LazyConfig
  from detectron2.data import MetadataCatalog, build_detection_test_loader, build_detection_train_loader
  from detectron2.evaluation import DatasetEvaluator, inference_on_dataset, print_csv_format, verify_results
  from detectron2.modeling import build_model
  from detectron2.solver import build_lr_scheduler, build_optimizer
  from detectron2.utils import comm
  from detectron2.utils.collect_env import collect_env_info
  from detectron2.utils.env import seed_all_rng
  from detectron2.utils.events import CommonMetricPrinter, JSONWriter, TensorboardXWriter
  from detectron2.utils.file_io import PathManager
  from detectron2.utils.logger import setup_logger
  from .None import hooks
  from .train_loop import AMPTrainer, SimpleTrainer, TrainerBase
label_desc: Use image node_id 3 for calling a global function with example usage: _try_get_key(cfg) and returns: default, p