code: def _check_spaces(env: gym.Env) -> None:
      """
      Check that the observation and action spaces are defined
      and inherit from gym.spaces.Space.
      """
      # Helper to link to the code, because gym has no proper documentation
      gym_spaces = (
          " cf https://github.com/openai/gym/blob/master/gym/spaces/"
      )
  
      assert hasattr(env, "observation_space"), (
          "You must specify an observation space (cf gym.spaces)"
          + gym_spaces
      )
      assert hasattr(env, "action_space"), (
          "You must specify an action space (cf gym.spaces)"
          + gym_spaces
      )
  
      assert isinstance(env.observation_space, spaces.Space), (
          "The observation space must inherit from gym.spaces"
          + gym_spaces
      )
      assert isinstance(env.action_space, spaces.Space), (
          "The action space must inherit from gym.spaces" + gym_spaces
      )
  
file_path: stable-baselines/stable_baselines/common/env_checker.py
imports: import warnings
  from typing import Union
  import gym
  from gym import spaces
  import numpy
  from stable_baselines.common.vec_env import DummyVecEnv, VecCheckNan
label_desc: Use image node_id 7 for calling a global function with example usage: _check_spaces(env) without return types