(self, event_data, target_state)
Tracks child states to exit when the states is exited itself. This should not
            be triggered by the user but will be handled by the hierarchical machine.
        Args:
            event_data (EventData): Event related data.
            target_state (NestedState): The state to be entered.

        Returns: int level of the currently investigated (sub)state.
Tracks child states to exit when the states is exited itself. This should not
            be triggered by the user but will be handled by the hierarchical machine.
        Args:
            event_data (EventData): Event related data.
            target_state (NestedState): The state to be entered.
Tracks child states to exit when the states is exited itself . This should not be triggered by the user but will be handled by the hierarchical machine . Args : event_data ( EventData ) : Event related data . target_state ( NestedState ) : The state to be entered .
def exit_nested(self, event_data, target_state):
        """ Tracks child states to exit when the states is exited itself. This should not
            be triggered by the user but will be handled by the hierarchical machine.
        Args:
            event_data (EventData): Event related data.
            target_state (NestedState): The state to be entered.

        Returns: int level of the currently investigated (sub)state.

        """
        if self == target_state:
            self.exit(event_data)
            return self.level
        elif self.level > target_state.level:
            self.exit(event_data)
            return self.parent.exit_nested(event_data, target_state)
        elif self.level <= target_state.level:
            tmp_state = target_state
            while self.level != tmp_state.level:
                tmp_state = tmp_state.parent
            tmp_self = self
            while tmp_self.level > 0 and tmp_state.parent.name != tmp_self.parent.name:
                tmp_self.exit(event_data)
                tmp_self = tmp_self.parent
                tmp_state = tmp_state.parent
            if tmp_self == tmp_state:
                return tmp_self.level + 1
            tmp_self.exit(event_data)
            return tmp_self.level
def exit_nested ( self , event_data , target_state ) : if self == target_state : self . exit ( event_data ) return self . level elif self . level > target_state . level : self . exit ( event_data ) return self . parent . exit_nested ( event_data , target_state ) elif self . level <= target_state . level : tmp_state = target_state while self . level != tmp_state . level : tmp_state = tmp_state . parent tmp_self = self while tmp_self . level > 0 and tmp_state . parent . name != tmp_self . parent . name : tmp_self . exit ( event_data ) tmp_self = tmp_self . parent tmp_state = tmp_state . parent if tmp_self == tmp_state : return tmp_self . level + 1 tmp_self . exit ( event_data ) return tmp_self . level