code: def _get_variables_from_config(config: Union[str, Path, dict]):
      """Read config's variables"""
      if isinstance(config, (str, Path)):
          config = read_json(find_config(config))
  
      variables = {
          "DEEPPAVLOV_PATH": os.getenv(
              f"DP_DEEPPAVLOV_PATH", Path(__file__).parent.parent.parent
          )
      }
      variables_exact = {f"{{{k}}}": v for k, v in variables.items()}
      for name, value in (
          config.get("metadata", {}).get("variables", {}).items()
      ):
          env_name = f"DP_{name}"
          if env_name in os.environ:
              value = os.getenv(env_name)
          if value in variables_exact:
              value = variables_exact[value]
          elif isinstance(value, str):
              value = value.format(**variables)
          variables[name] = value
          variables_exact[f"{{{name}}}"] = value
  
      return variables, variables_exact
  
file_path: DeepPavlov/deeppavlov/core/commands/utils.py
imports: import os
  from copy import deepcopy
  from pathlib import Path
  from typing import Any, Union, Dict, TypeVar, Optional
  from deeppavlov.core.common.file import read_json, find_config
  from deeppavlov.core.common.registry import inverted_registry
  from deeppavlov.core.data.utils import get_all_elems_from_json
label_desc: Use image node_id 2 for calling a global function with example usage: _get_variables_from_config(config) and returns: variables,  variables_exact