code: def calc_reward_to_go(reward_list, gamma=1.0):
      for i in range(len(reward_list) - 2, -1, -1):
          # G_i = r_i + γ·G_i+1
          reward_list[i] += gamma * reward_list[i + 1]  # Gt
      return np.array(reward_list)
  
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 3 for calling a global function with example usage: calc_reward_to_go(reward_list, gamma) and returns: np