code: def _update_config(args, update_fn, allow_missing=False):
      
      new_i = None
      for i, arg in enumerate(args):
          if (is_std_config_arg(arg) or is_nested_config_arg(arg) or
                (isinstance(arg, (list, tuple)) and is_nested_config_arg(arg[0]))):
              new_i = i
              break
      if new_i is None:
          if allow_missing:
              return args
          else:
              raise ValueError("Could not find configuration in args: %s" % str(args))
  
      new_arg = args[new_i]
      if is_nested_config_arg(new_arg):
          new_arg["config"] = update_fn(copy.deepcopy(new_arg["config"]))
      elif is_std_config_arg(new_arg):
          new_arg = update_fn(copy.deepcopy(new_arg))
      elif isinstance(arg, (list, tuple)) and is_nested_config_arg(new_arg[0]):
          new_arg_first = new_arg[0]
          new_arg_first["config"] = update_fn(copy.deepcopy(new_arg_first["config"]))
          new_arg = [new_arg_first] + new_arg[1:]
      else:
          raise ValueError("Unexpected configuration dictionary: %s" % new_arg)
      args = list(args)[:]
      args[new_i] = new_arg
      return args
docs: Update configuration, nested in argument list, with the provided update function.