code: def parse_config(
      config: Union[str, Path, dict], overwrite: Optional[dict] = None
  ) -> dict:
      """Apply metadata.variables values to placeholders inside config and update nested configs using overwrite parameter
  
      Args:
          config: Config to parse.
          overwrite: If not None - key-value pairs of nested keys and values to overwrite config.
              For {'chainer.pipe.0.class_name': 'simple_vocab'} it will update config
              config['chainer']['pipe'][0]['class_name'] = 'simple_vocab'.
  
      """
      if isinstance(config, (str, Path)):
          config = read_json(find_config(config))
  
      if overwrite is not None:
          for key, value in overwrite.items():
              items = [
                  int(item) if item.isdigit() else item
                  for item in key.split(".")
              ]
              _overwrite(config, value, items)
  
      updated_config = _update_requirements(config)
  
      variables, variables_exact = _get_variables_from_config(
          updated_config
      )
  
      return _parse_config_property(
          updated_config, 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 5 for calling a global function with example usage: parse_config(config, overwrite) and returns: _parse_config_property