<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_state(self, name: str, state: State, initial: bool = False):
 """ Adds a new state to the FSM. Args: name (str):
 the name of the state, which is used as its identifier. state (spade.behaviour.State):
 The state class initial (bool, optional):
 wether the state is the initial state or not. (Only one initial state is allowed) (Default value = False) """

        if not issubclass(state.__class__, State):
            raise AttributeError("state must be subclass of spade.behaviour.State")
        self._states[name] = state
        if initial:
            self.current_state = name