code: def _check_obs(
      obs: Union[tuple, dict, np.ndarray, int],
      observation_space: spaces.Space,
      method_name: str,
  ) -> None:
      """
      Check that the observation returned by the environment
      correspond to the declared one.
      """
      if not isinstance(observation_space, spaces.Tuple):
          assert not isinstance(obs, tuple), (
              "The observation returned by the `{}()` "
              "method should be a single value, not a tuple".format(
                  method_name
              )
          )
  
      # The check for a GoalEnv is done by the base class
      if isinstance(observation_space, spaces.Discrete):
          assert isinstance(
              obs, int
          ), "The observation returned by `{}()` method must be an int".format(
              method_name
          )
      elif _enforce_array_obs(observation_space):
          assert isinstance(obs, np.ndarray), (
              "The observation returned by `{}()` "
              "method must be a numpy array".format(method_name)
          )
  
      assert observation_space.contains(obs), (
          "The observation returned by the `{}()` "
          "method does not match the given observation space".format(
              method_name
          )
      )
  
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 5 for calling a global function with example usage: _check_obs(obs, observation_space, method_name) without return types