<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, state, storage_load=False):
 """Adds a state to the container state. :param state: the state that is going to be added :param storage_load: True if the state was directly loaded from filesystem :return: the state_id of the new state :raises exceptions.AttributeError: if state.state_id already exist """

        assert isinstance(state, State)
        # logger.info("add state {}".format(state))

        # handle the case that the child state id is the same as the container state id or future sibling state id
        while state.state_id == self.state_id or state.state_id in self.states:
            state.change_state_id()

        # TODO: add validity checks for states and then remove this check => to discuss
        if state.state_id in self._states.keys():
            raise AttributeError("State id %s already exists in the container state", state.state_id)
        else:
            state.parent = self
            self._states[state.state_id] = state

        return state.state_id