class_docstr: Wraps an environment allowing keyboard inputs to interact with the environment.
class_docstr_tok: ["Wraps","an","environment","allowing","keyboard","inputs","to","interact","with","the","environment","."]
code: def _get_relevant_keys(
      self, keys_to_action: Optional[Dict[Tuple[int], int]] = None
  ) -> set:
      if keys_to_action is None:
          if hasattr(self.env, "get_keys_to_action"):
              keys_to_action = self.env.get_keys_to_action()
          elif hasattr(self.env.unwrapped, "get_keys_to_action"):
              keys_to_action = self.env.unwrapped.get_keys_to_action()
          else:
              raise MissingKeysToAction(
                  f"{self.env.spec.id} does not have explicit key to action mapping, "
                  "please specify one manually"
              )
      assert isinstance(keys_to_action, dict)
      relevant_keys = set(
          sum((list(k) for k in keys_to_action.keys()), [])
      )
      return relevant_keys
  
file_path: gym/gym/utils/play.py
imports: from collections import deque
  from typing import Callable, Dict, List, Optional, Tuple, Union
  import numpy
  import gym.error
  from gym import Env, logger
  from gym.core import ActType, ObsType
  from gym.error import DependencyNotInstalled
  from gym.logger import deprecation
label_desc: Use image node_id 2 for calling the PlayableGame obj's underlying member method code with example usage: obj._get_relevant_keys(keys_to_action) and returns: relevant_keys