code: def train_agent_real_env(env, learner, hparams, epoch):
      """Train the PPO agent in the real environment."""
      base_algo_str = hparams.base_algo
  
      train_hparams = trainer_lib.create_hparams(
          hparams.base_algo_params
      )
      rl_utils.update_hparams_from_hparams(
          train_hparams, hparams, "real_" + base_algo_str + "_"
      )
      if hparams.wm_policy_param_sharing:
          train_hparams.optimizer_zero_grads = True
  
      env_fn = rl.make_real_env_fn(env)
      num_env_steps = real_env_step_increment(hparams)
      learner.train(
          env_fn,
          train_hparams,
          simulated=False,
          save_continuously=False,
          epoch=epoch,
          sampling_temp=hparams.real_sampling_temp,
          num_env_steps=num_env_steps,
      )
      # Save unfinished rollouts to history.
      env.reset()
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import datetime
  import math
  import os
  import pprint
  import random
  import time
  import six
  from tensor2tensor.bin import t2t_trainer
  from tensor2tensor.models.research import rl
  from tensor2tensor.rl import rl_utils
  from tensor2tensor.rl import trainer_model_based_params
  from tensor2tensor.rl.dopamine_connector import DQNLearner
  from tensor2tensor.rl.restarter import Restarter
  from tensor2tensor.utils import trainer_lib
  import tensorflow.compat.v1
label_desc: Use image node_id 9 for calling a global function with example usage: train_agent_real_env(env, learner, hparams, epoch) without return types