code: def update_config_dict(
      dic: dict,
      learning_rate: Optional[float] = None,
      batch_size: Optional[int] = None,
      nepochs: Optional[int] = None,
      labeled_ratio: Optional[int] = None,
      opts: Optional[list] = None,
  ):
      """Update config"""
      # TODO: If the items to update are marked as anchors in the yaml file,
      # we should synchronize the references.
      dic = dic.copy()
  
      if learning_rate:
          dic["lr_scheduler_r"]["learning_rate"] = learning_rate
          dic["lr_scheduler_l"]["learning_rate"] = learning_rate
      if batch_size:
          dic["batch_size"] = batch_size
      if nepochs:
          dic["nepochs"] = nepochs
  
      if labeled_ratio:
          dic["labeled_ratio"] = labeled_ratio
  
      if opts is not None:
          for item in opts:
              assert ("=" in item) and (len(item.split("=")) == 2), (
                  "--opts params should be key=value,"
                  " such as `--opts batch_size=1 test_config.scales=0.75,1.0,1.25`, "
                  "but got ({})".format(opts)
              )
  
              key, value = item.split("=")
              if isinstance(value, six.string_types):
                  try:
                      value = literal_eval(value)
                  except ValueError:
                      pass
                  except SyntaxError:
                      pass
              key_list = key.split(".")
  
              tmp_dic = dic
              for subkey in key_list[:-1]:
                  assert (
                      subkey in tmp_dic
                  ), "Can not update {}, because it is not in config.".format(
                      key
                  )
                  tmp_dic = tmp_dic[subkey]
              tmp_dic[key_list[-1]] = value
  
      return dic
  
imports: import six
  import codecs
  import os
  from ast import literal_eval
  from typing import Any, Dict, Optional
  import yaml
  from paddleseg.cvlibs import config_checker
  from paddleseg.utils import utils
label_desc: Use image node_id 3 for calling a global function with example usage: update_config_dict(dic, learning_rate, batch_size, nepochs, labeled_ratio, opts) and returns: dic