code: def _gen_args(op_cmd, flag_vals, resolve_params, force_flag_args):
      encoded_resolve_params = _encode_arg_params(resolve_params)
      args = []
      for arg in op_cmd.cmd_args:
          if arg == "__flag_args__":
              _apply_flag_args(flag_vals, op_cmd, force_flag_args, args)
          else:
              args.append(
                  util.resolve_refs(arg, encoded_resolve_params)
              )
      return args
  
imports: import logging
  import pprint
  from guild import flag_util
  from guild import util
  from guild import yaml_util
label_desc: Use image node_id 2 for calling a global function with example usage: _gen_args(op_cmd, flag_vals, resolve_params, force_flag_args) and returns: args