code: def get_completed_trajectories_from_env(
      env, n_trajectories, raw_trajectory=False
  ):
      """Returns completed `n_trajectories` from `env`."""
  
      # Just the raw trajectories.
      if raw_trajectory:
          return env.trajectories.completed_trajectories[
              :n_trajectories
          ]
  
      # The numpy version of the above.
      completed_trajectories = []
      for trajectory in env.trajectories.completed_trajectories[
          :n_trajectories
      ]:
          completed_trajectories.append(trajectory.as_numpy)
      return completed_trajectories
  
file_path: tensor2tensor/tensor2tensor/envs/env_problem_utils.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import functools
  import time
  import gym
  import numpy
  from tensor2tensor.envs import gym_env_problem
  from tensor2tensor.envs import rendered_env_problem
  from tensor2tensor.rl import gym_utils
label_desc: Use image node_id 3 for calling a global function with example usage: get_completed_trajectories_from_env(env, n_trajectories, raw_trajectory) and returns: completed_trajectories, env