code: def get_gae(rewards, value_estimates, value_next=0.0, gamma=0.99, lambd=0.95):
      
      value_estimates = np.asarray(value_estimates.tolist() + [value_next])
      delta_t = rewards + gamma * value_estimates[1:] - value_estimates[:-1]
      advantage = discount_rewards(r=delta_t, gamma=gamma * lambd)
      return advantage
docs: Computes generalized advantage estimate for use in updating policy.
      :param rewards: list of rewards for time-steps t to T.
      :param value_next: Value estimate for time-step T+1.
      :param value_estimates: list of value estimates for time-steps t to T.
      :param gamma: Discount factor.
      :param lambd: GAE weighing factor.
      :return: list of advantage estimates for time-steps t to T.