code: def test_pickle_env(env: gym.Env):
      pickled_env = pickle.loads(pickle.dumps(env))
  
      data_equivalence(env.reset(), pickled_env.reset())
  
      action = env.action_space.sample()
      data_equivalence(env.step(action), pickled_env.step(action))
      env.close()
      pickled_env.close()
  
file_path: gym/tests/envs/test_envs.py
imports: import pickle
  import warnings
  import numpy
  import pytest
  import gym
  from gym.envs.registration import EnvSpec
  from gym.logger import warn
  from gym.utils.env_checker import check_env, data_equivalence
  from tests.envs.utils import all_testing_env_specs, all_testing_initialised_envs, assert_equals
label_desc: Use image node_id 5 for calling a global function with example usage: test_pickle_env(env) without return types