def METHOD_NAME(self, event):
    if self.reset_state_key.match(event):
        self._history_index = 0
        self._reset_state_pressed()
        event.handled = True
    elif self.prev_state_key.match(event):
        if self._history_index > 0:
            self._history_index -= 1
            self._prev_state_pressed()
        event.handled = True
    elif self.next_state_key.match(event):
        if self._history_index <= len(self._history) - 2:
            self._history_index += 1
            self._next_state_pressed()
        event.handled = True
    else:
        return