code: def test_custom_policy(request, model_name):
      """
      Test if the algorithm (with a custom policy) can be loaded and saved without any issues.
      :param model_name: (str) A RL model
      """
  
      try:
          model_class, policy, _ = MODEL_DICT[model_name]
          env = (
              "MountainCarContinuous-v0"
              if model_name in ["ddpg", "sac"]
              else "CartPole-v1"
          )
  
          # create and train
          model = model_class(policy, env)
          model.learn(total_timesteps=100)
  
          env = model.get_env()
          # predict and measure the acc reward
          obs = env.reset()
          for _ in range(N_TRIALS):
              action, _ = model.predict(obs)
              # Test action probability method
              if model_name not in ["ddpg", "sac"]:
                  model.action_probability(obs)
              obs, _, _, _ = env.step(action)
          # saving
          model_fname = "./test_model_{}.zip".format(request.node.name)
          model.save(model_fname)
          del model, env
          # loading
          _ = model_class.load(model_fname, policy=policy)
  
      finally:
          if os.path.exists(model_fname):
              os.remove(model_fname)
  
imports: import os
  import gym
  import pytest
  import tensorflow
  from stable_baselines import A2C, ACER, ACKTR, DQN, PPO1, PPO2, TRPO, SAC, DDPG
  from stable_baselines.common.policies import FeedForwardPolicy
  from stable_baselines.common.vec_env import DummyVecEnv
  from stable_baselines.deepq.policies import FeedForwardPolicy
  from stable_baselines.ddpg.policies import FeedForwardPolicy
  from stable_baselines.sac.policies import FeedForwardPolicy
label_desc: Use image node_id 1 for calling a global function with example usage: test_custom_policy(request, model_name) without return types