code: def obtain_evaluation_episodes(
      policy,
      env,
      max_episode_length=1000,
      num_eps=100,
      deterministic=True,
  ):
      """Sample the policy for num_eps episodes and return average values.
  
      Args:
          policy (Policy): Policy to use as the actor when gathering samples.
          env (Environment): The environement used to obtain episodes.
          max_episode_length (int): Maximum episode length. The episode will
              truncated when length of episode reaches max_episode_length.
          num_eps (int): Number of episodes.
          deterministic (bool): Whether the a deterministic approach is used
              in rollout.
  
      Returns:
          EpisodeBatch: Evaluation episodes, representing the best current
              performance of the algorithm.
  
      """
      episodes = []
      # Use a finite length rollout for evaluation.
  
      with click.progressbar(
          range(num_eps), label="Evaluating"
      ) as pbar:
          for _ in pbar:
              eps = rollout(
                  env,
                  policy,
                  max_episode_length=max_episode_length,
                  deterministic=deterministic,
              )
              episodes.append(eps)
      return EpisodeBatch.from_list(env.spec, episodes)
  
file_path: garage/src/garage/_functions.py
imports: from collections import defaultdict
  import time
  import click
  from dowel import tabular
  import numpy
  from garage import EpisodeBatch, StepType
  from garage.np import discount_cumsum, stack_tensor_dict_list
label_desc: Use image node_id 3 for calling a global function with example usage: obtain_evaluation_episodes(policy, env, max_episode_length, num_eps, deterministic) and returns: EpisodeBatch