code: def _check_render(
      env: gym.Env, warn: bool = True, headless: bool = False
  ) -> None:
      """
      Check the declared render modes and the `render()`/`close()`
      method of the environment.
  
      :param env: (gym.Env) The environment to check
      :param warn: (bool) Whether to output additional warnings
      :param headless: (bool) Whether to disable render modes
          that require a graphical interface. False by default.
      """
      render_modes = env.metadata.get("render.modes")
      if render_modes is None:
          if warn:
              warnings.warn(
                  "No render modes was declared in the environment "
                  " (env.metadata['render.modes'] is None or not defined), "
                  "you may have trouble when calling `.render()`"
              )
  
      else:
          # Don't check render mode that require a
          # graphical interface (useful for CI)
          if headless and "human" in render_modes:
              render_modes.remove("human")
          # Check all declared render modes
          for render_mode in render_modes:
              env.render(mode=render_mode)
          env.close()
  
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 8 for calling a global function with example usage: _check_render(env, warn, headless) without return types