code: def _override_attr(
      sub_node: str, data_class: Type[FairseqDataclass], args: Namespace
  ) -> List[str]:
      overrides = []
  
      if not inspect.isclass(data_class) or not issubclass(
          data_class, FairseqDataclass
      ):
          return overrides
  
      def get_default(f):
          if not isinstance(f.default_factory, _MISSING_TYPE):
              return f.default_factory()
          return f.default
  
      for k, v in data_class.__dataclass_fields__.items():
          if k.startswith("_"):
              # private member, skip
              continue
  
          val = (
              get_default(v)
              if not hasattr(args, k)
              else getattr(args, k)
          )
  
          field_type = interpret_dc_type(v.type)
          if (
              isinstance(val, str)
              and not val.startswith("${")  # not interpolation
              and field_type != str
              and (
                  not inspect.isclass(field_type)
                  or not issubclass(field_type, Enum)
              )  # not choices enum
          ):
              # upgrade old models that stored complex parameters as string
              val = ast.literal_eval(val)
  
          if isinstance(val, tuple):
              val = list(val)
  
          v_type = getattr(v.type, "__origin__", None)
          if (
              (v_type is List or v_type is list or v_type is Optional)
              # skip interpolation
              and not (isinstance(val, str) and val.startswith("${"))
          ):
              # if type is int but val is float, then we will crash later - try to convert here
              if hasattr(v.type, "__args__"):
                  t_args = v.type.__args__
                  if len(t_args) == 1 and (
                      t_args[0] is float or t_args[0] is int
                  ):
                      val = list(map(t_args[0], val))
          elif val is not None and (
              field_type is int
              or field_type is bool
              or field_type is float
          ):
              try:
                  val = field_type(val)
              except:
                  pass  # ignore errors here, they are often from interpolation args
  
          if val is None:
              overrides.append("{}.{}=null".format(sub_node, k))
          elif val == "":
              overrides.append("{}.{}=''".format(sub_node, k))
          elif isinstance(val, str):
              val = val.replace("'", r"\'")
              overrides.append("{}.{}='{}'".format(sub_node, k, val))
          elif isinstance(val, FairseqDataclass):
              overrides += _override_attr(
                  f"{sub_node}.{k}", type(val), args
              )
          elif isinstance(val, Namespace):
              sub_overrides, _ = override_module_args(val)
              for so in sub_overrides:
                  overrides.append(f"{sub_node}.{k}.{so}")
          else:
              overrides.append("{}.{}={}".format(sub_node, k, val))
  
      return overrides
  
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 5 for calling a global function with example usage: _override_attr(sub_node, data_class, args) and returns: overrides, overrides, f, f