code: def offline_gym_random(
      env_name: str,
      pkl_path: str,
      num_train_transitions: int,
      max_steps: Optional[int],
      seed: int = 1,
  ):
      """
      Generate samples from a random Policy on the Gym environment and
      saves results in a pandas df parquet.
      """
      env = Gym(env_name=env_name)
      random_policy = make_random_policy_for_env(env)
      agent = Agent.create_for_env(env, policy=random_policy)
      return _offline_gym(
          env, agent, pkl_path, num_train_transitions, max_steps, seed
      )
  
imports: import json
  import logging
  from typing import Optional
  import gym
  import numpy
  import pandas
  import pytorch_lightning
  import torch
  from reagent.data.spark_utils import call_spark_class, get_spark_session
  from reagent.gym.agents.agent import Agent
  from reagent.gym.envs import Gym
  from reagent.gym.policies.predictor_policies import create_predictor_policy_from_model
  from reagent.gym.policies.random_policies import make_random_policy_for_env
  from reagent.gym.runners.gymrunner import evaluate_for_n_episodes
  from reagent.gym.utils import fill_replay_buffer
  from reagent.model_managers.union import ModelManager__Union
  from reagent.publishers.union import FileSystemPublisher, ModelPublisher__Union
  from reagent.replay_memory.circular_replay_buffer import ReplayBuffer
  from reagent.replay_memory.utils import replay_buffer_to_pre_timeline_df
  from .types import TableSpec
label_desc: Use image node_id 2 for calling a global function with example usage: offline_gym_random(env_name, pkl_path, num_train_transitions, max_steps, seed) and returns: _offline_gym