code: def check_rendered(rendered_frame, mode: str):
      """Check that the rendered frame is as expected."""
      if mode == "rgb_array_list":
          assert isinstance(rendered_frame, list)
          for frame in rendered_frame:
              check_rendered(frame, "rgb_array")
      elif mode == "rgb_array":
          assert isinstance(rendered_frame, np.ndarray)
          assert len(rendered_frame.shape) == 3
          assert rendered_frame.shape[2] == 3
          assert np.all(rendered_frame >= 0) and np.all(
              rendered_frame <= 255
          )
      elif mode == "ansi":
          assert isinstance(rendered_frame, str)
          assert len(rendered_frame) > 0
      elif mode == "state_pixels_list":
          assert isinstance(rendered_frame, list)
          for frame in rendered_frame:
              check_rendered(frame, "rgb_array")
      elif mode == "state_pixels":
          check_rendered(rendered_frame, "rgb_array")
      elif mode == "depth_array_list":
          assert isinstance(rendered_frame, list)
          for frame in rendered_frame:
              check_rendered(frame, "depth_array")
      elif mode == "depth_array":
          assert isinstance(rendered_frame, np.ndarray)
          assert len(rendered_frame.shape) == 2
      else:
          warn(
              f"Unknown render mode: {mode}, cannot check that the rendered data is correct. Add case to `check_rendered`"
          )
  
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 3 for calling a global function with example usage: check_rendered(rendered_frame, mode) without return types