code: def overwrite_args_by_name(
      cfg: DictConfig, overrides: Dict[str, any]
  ):
      # this will be deprecated when we get rid of argparse and model_overrides logic
  
      from fairseq.registry import REGISTRIES
  
      with open_dict(cfg):
          for k in cfg.keys():
              # "k in cfg" will return false if its a "mandatory value (e.g. ???)"
              if k in cfg and isinstance(cfg[k], DictConfig):
                  if k in overrides and isinstance(overrides[k], dict):
                      for ok, ov in overrides[k].items():
                          if (
                              isinstance(ov, dict)
                              and cfg[k][ok] is not None
                          ):
                              overwrite_args_by_name(cfg[k][ok], ov)
                          else:
                              cfg[k][ok] = ov
                  else:
                      overwrite_args_by_name(cfg[k], overrides)
              elif k in cfg and isinstance(cfg[k], Namespace):
                  for override_key, val in overrides.items():
                      setattr(cfg[k], override_key, val)
              elif k in overrides:
                  if (
                      k in REGISTRIES
                      and overrides[k]
                      in REGISTRIES[k]["dataclass_registry"]
                  ):
                      cfg[k] = DictConfig(
                          REGISTRIES[k]["dataclass_registry"][
                              overrides[k]
                          ]
                      )
                      overwrite_args_by_name(cfg[k], overrides)
                      cfg[k]._name = overrides[k]
                  else:
                      cfg[k] = overrides[k]
  
imports: import ast
  import inspect
  import logging
  import os
  import re
  from argparse import ArgumentError, ArgumentParser, Namespace
  from dataclasses import _MISSING_TYPE, MISSING, is_dataclass
  from enum import Enum
  from typing import Any, Dict, List, Optional, Tuple, Type
  from fairseq.dataclass import FairseqDataclass
  from fairseq.dataclass.configs import FairseqConfig
  from hydra.core.global_hydra import GlobalHydra
  from hydra.experimental import compose, initialize
  from omegaconf import DictConfig, OmegaConf, open_dict, _utils
label_desc: Use image node_id 9 for calling a global function with example usage: overwrite_args_by_name(cfg, overrides) without return types