code: def _space_for_flag_val(val, label):
      if isinstance(val, list):
          return hyperopt.hp.choice(label, val)
      else:
          try:
              func_name, func_args = flag_util.decode_flag_function(val)
          except ValueError:
              return hyperopt.hp.choice(label, [val])
          else:
              return _space_for_func(func_name, func_args, label, val)
  
file_path: guildai/examples/hyperopt/tpe.py
imports: import logging
  from guild import batch_util
  from guild import flag_util
  from guild import index
  import numpy
  import hyperopt
label_desc: Use image node_id 4 for calling a global function with example usage: _space_for_flag_val(val, label) and returns: hyperopt, _space_for_func, hyperopt