code: def _batch_trials(batch_run):
      proto_flag_vals = batch_run.batch_proto.get("flags")
      batch_run = batch_util.batch_run()
      max_trials = batch_run.get("max_trials") or DEFAULT_MAX_TRIALS
      random_seed = batch_run.get("random_seed")
      try:
          return skopt_util.random_trials_for_flags(
              proto_flag_vals, max_trials, random_seed
          )
      except skopt_util.MissingSearchDimension:
          skopt_util.missing_search_dim_error(proto_flag_vals)
      except skopt_util.InvalidSearchDimension as e:
          _search_dim_error(e)
      except batch_util.InvalidFlagFunctionArgs as e:
          batch_util.invalid_flag_function_args_error(e)
  
file_path: guildai/guild/plugins/random_main.py
imports: import logging
  import sys
  import typing
  from guild import batch_util
  from .None import skopt_util
label_desc: Use image node_id 2 for calling a global function with example usage: _batch_trials(batch_run) and returns: skopt_util