code: def run_evaluate_episodes(agent, eval_episodes=5, render=False):
      # Compatible for different versions of gym
      if (
          is_gym_version_ge("0.26.0") and render
      ):  # if gym version >= 0.26.0
          env = gym.make("CartPole-v1", render_mode="human")
      else:
          env = gym.make("CartPole-v1")
      env = CompatWrapper(env)
  
      eval_reward = []
      for i in range(eval_episodes):
          obs = env.reset()
          episode_reward = 0
          while True:
              action = agent.predict(obs)
              obs, reward, isOver, _ = env.step(action)
              episode_reward += reward
              if render:
                  env.render()
              if isOver:
                  break
          eval_reward.append(episode_reward)
      return np.mean(eval_reward)
  
file_path: PARL/examples/QuickStart/train.py
imports: import os
  import gym
  import numpy
  import parl
  from parl.utils import logger
  from parl.env import CompatWrapper, is_gym_version_ge
  from cartpole_model import CartpoleModel
  from cartpole_agent import CartpoleAgent
  import argparse
label_desc: Use image node_id 2 for calling a global function with example usage: run_evaluate_episodes(agent, eval_episodes, render) and returns: np