def set_state(self, new_state):
if new_state not in self.known_states:<EOL><INDENT>raise ValueError(f"<STR_LIT>")<EOL><DEDENT>self._previous_state = self._current_state<EOL>self._current_state = new_state<EOL>if self._current_state != self._previous_state:<EOL><INDENT>self._states[self._current_state].unhide()<EOL>try: self._states[self._previous_state].hide()<EOL>except KeyError: pass<EOL><DEDENT>
Set the state currently being displayed by the deck.

It is an error for the given state to not already be part of the deck.