def add_state(self, key, state=None): """Add state""" if not key in self._states: if not state: state = get_void_state() self._states[key] = state else: raise Exception(str(key) + " is already a state.")