<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def check_transition_id(self, transition_id):
 """ Check the transition id and calculate a new one if its None :param transition_id: The transition-id to check :return: The new transition id :raises exceptions.AttributeError: if transition.transition_id already exists """

        if transition_id is not None:
            if transition_id in self._transitions.keys():
                raise AttributeError("The transition id %s already exists. Cannot add transition!", transition_id)
        else:
            transition_id = generate_transition_id()
            while transition_id in self._transitions.keys():
                transition_id = generate_transition_id()
        return transition_id