code: def _gen_env(op_cmd, flag_vals):
      env = _encoded_cmd_env(op_cmd)
      _resolve_env_flag_refs(flag_vals, env)
      _apply_flag_env(flag_vals, op_cmd, env)
      return env
  
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 18 for calling a global function with example usage: _gen_env(op_cmd, flag_vals) and returns: env