code: def test_taxi_action_mask():
      env = TaxiEnv()
  
      for state in env.P:
          mask = env.action_mask(state)
          for action, possible in enumerate(mask):
              _, next_state, _, _ = env.P[state][action][0]
              assert (
                  state != next_state
                  if possible
                  else state == next_state
              )
  
file_path: gym/tests/envs/test_env_implementation.py
imports: from typing import Optional
  import numpy
  import pytest
  import gym
  from gym.envs.box2d import BipedalWalker
  from gym.envs.box2d.lunar_lander import demo_heuristic_lander
  from gym.envs.toy_text import TaxiEnv
  from gym.envs.toy_text.frozen_lake import generate_random_map
label_desc: Use image node_id 5 for calling a global function with example usage: test_taxi_action_mask() without return types