code: def _batch_trials(batch_run):
      random_seed = batch_run.get("random_seed")
      all_trials = _expand_batch_trials(batch_run, random_seed)
      max_trials = batch_run.get("max_trials")
      if max_trials is None:
          return all_trials
      return batch_util.sample_trials(
          all_trials, max_trials, random_seed
      )
  
imports: from guild import batch_util
  from guild import op_util
label_desc: Use image node_id 2 for calling a global function with example usage: _batch_trials(batch_run) and returns: batch_util, all_trials