<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_next_upper_library_root_state(self):
 """ Get next upper library root state The method recursively checks state parent states till finding a StateMachine as parent or a library root state. If self is a LibraryState the next upper library root state is searched and it is not handed self.state_copy. :return library root state (Execution or ContainerState) or None if self is not a library root state or inside of such :rtype rafcon.core.states.library_state.State: """

        from rafcon.core.state_machine import StateMachine

        if self.is_root_state_of_library:
            return self

        state = self
        while state.parent is not None and not isinstance(state.parent, StateMachine):
            if state.parent.is_root_state_of_library:
                return state.parent
            state = state.parent
        return None