code: def _prepare_input_dict_or_list(
      d: Union[Dict[Any, Any], List[Any]]
  ) -> Any:
      res: Any
      if isinstance(d, dict):
          res = {}
          for k, v in d.items():
              if k == "_target_":
                  v = _convert_target_to_string(d["_target_"])
              elif isinstance(v, (dict, list)):
                  v = _prepare_input_dict_or_list(v)
              res[k] = v
      elif isinstance(d, list):
          res = []
          for v in d:
              if isinstance(v, (list, dict)):
                  v = _prepare_input_dict_or_list(v)
              res.append(v)
      else:
          assert False
      return res
  
imports: import copy
  import functools
  from enum import Enum
  from textwrap import dedent
  from typing import Any, Callable, Dict, List, Sequence, Tuple, Union
  from omegaconf import OmegaConf, SCMode
  from omegaconf._utils import is_structured_config
  from hydra._internal.utils import _locate
  from hydra.errors import InstantiationException
  from hydra.types import ConvertMode, TargetConf
label_desc: Use image node_id 5 for calling a global function with example usage: _prepare_input_dict_or_list(d) and returns: res