code: def _cast_to_config(obj):
      # if given a dict, return DictConfig instead
      if isinstance(obj, dict):
          return DictConfig(obj, flags={"allow_objects": True})
      return obj
  
imports: import ast
  import builtins
  import collections.abc
  import importlib
  import inspect
  import logging
  import os
  import uuid
  from contextlib import contextmanager
  from copy import deepcopy
  from dataclasses import is_dataclass
  from typing import List, Tuple, Union
  import cloudpickle
  import yaml
  from omegaconf import DictConfig, ListConfig, OmegaConf, SCMode
  from detectron2.utils.file_io import PathManager
  from detectron2.utils.registry import _convert_target_to_string
label_desc: Use image node_id 3 for calling a global function with example usage: _cast_to_config(obj) and returns: obj, DictConfig