code: def check_old_gym_env(
      env: Optional[gym.Env] = None,
      *,
      step_results=None,
      reset_results=None,
  ):
      # Check `reset()` results.
      if reset_results is not None:
          if (
              # Result is NOT a tuple?
              not isinstance(reset_results, tuple)
              # Result is a tuple of len!=2?
              or len(reset_results) != 2
              # The second item is a NOT dict (infos)?
              or not isinstance(reset_results[1], dict)
              # Result is a tuple of len=2 and the second item is a dict (infos) and
              # our env does NOT have obs space 2-Tuple with the second space being a
              # dict?
              or (
                  env
                  and isinstance(
                      env.observation_space, gym.spaces.Tuple
                  )
                  and len(env.observation_space.spaces) >= 2
                  and isinstance(
                      env.observation_space.spaces[1], gym.spaces.Dict
                  )
              )
          ):
              raise ValueError(
                  "The number of values returned from `gym.Env.reset(seed=.., options=..)"
                  "` must be 2! Make sure your `reset()` method returns: [obs] and "
                  "[infos]."
              )
      # Check `step()` results.
      elif step_results is not None:
          if len(step_results) == 5:
              return False
          else:
              raise ValueError(
                  "The number of values returned from `gym.Env.step([action])` must be "
                  "5 (new gym.Env API including `truncated` flags)! Make sure your "
                  "`step()` method returns: [obs], [reward], [terminated], "
                  "[truncated], and [infos]!"
              )
  
      else:
          raise AttributeError(
              "Either `step_results` or `reset_results` most be provided to "
              "`check_old_gym_env()`!"
          )
      return False
  
imports: import gymnasium
  from typing import Optional
  from ray.util.annotations import DeveloperAPI
label_desc: Use image node_id 1 for calling a global function with example usage: check_old_gym_env(env) and returns: False, False