<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def handle_execution_mode(self, container_state, next_child_state_to_execute=None):
 """Checks the current execution status and returns it. Depending on the execution state, the calling thread (currently only hierarchy states) waits for the execution to continue. If the execution mode is any of the step modes, a condition variable stops the current execution, until it gets notified by the step_*() or backward_step() functions. :param container_state: the container_state, for which the execution mode is handled :param next_child_state_to_execute: is the next child state of :param state to be executed :return: the current state machine execution status """

        self.state_counter_lock.acquire()
        self.state_counter += 1
        # logger.verbose("Increase state_counter!" + str(self.state_counter))
        self.state_counter_lock.release()

        woke_up_from_pause_or_step_mode = False

        if (self._status.execution_mode is StateMachineExecutionStatus.PAUSED) \
                or (self._status.execution_mode is StateMachineExecutionStatus.STEP_MODE):
            self._wait_while_in_pause_or_in_step_mode()
            # new command was triggered => execution command has to handled
            container_state.execution_history.new_execution_command_handled = False
            woke_up_from_pause_or_step_mode = True

        # no elif here: if the execution woke up from e.g. paused mode, it has to check the current execution mode
        if self._status.execution_mode is StateMachineExecutionStatus.STARTED:
            # logger.debug("Execution engine started!")
            pass

        elif self._status.execution_mode is StateMachineExecutionStatus.STOPPED:
            logger.debug("Execution engine stopped. State '{0}' is going to quit in the case of "
                         "no preemption handling has to be done!".format(container_state.name))

        elif self._status.execution_mode is StateMachineExecutionStatus.FINISHED:
            # this must never happen during execution of the execution engine
            raise Exception

        else:  # all other step modes
            logger.verbose("before wait")
            self._wait_if_required(container_state, next_child_state_to_execute, woke_up_from_pause_or_step_mode)
            logger.verbose("after wait")

            # calculate states to which should be run
            if self._status.execution_mode is StateMachineExecutionStatus.BACKWARD:
                pass
            elif self._status.execution_mode is StateMachineExecutionStatus.FORWARD_INTO:
                pass
            elif self._status.execution_mode is StateMachineExecutionStatus.FORWARD_OVER:
                if not container_state.execution_history.new_execution_command_handled:
                    # the state that called this method is a hierarchy state => thus we save this state and wait until
                    # thise very state will execute its next state; only then we will wait on the condition variable
                    self.run_to_states.append(container_state.get_path())
                else:
                    pass
            elif self._status.execution_mode is StateMachineExecutionStatus.FORWARD_OUT:
                from rafcon.core.states.state import State
                if isinstance(container_state.parent, State):
                    if not container_state.execution_history.new_execution_command_handled:
                        from rafcon.core.states.library_state import LibraryState
                        if isinstance(container_state.parent, LibraryState):
                            parent_path = container_state.parent.parent.get_path()
                        else:
                            parent_path = container_state.parent.get_path()
                        self.run_to_states.append(parent_path)
                    else:
                        pass
                else:
                    # if step_out is called from the highest level just run the state machine to the end
                    self.run_to_states = []
                    self.set_execution_mode(StateMachineExecutionStatus.STARTED)
            elif self._status.execution_mode is StateMachineExecutionStatus.RUN_TO_SELECTED_STATE:
                # "run_to_states" were already updated thus doing nothing
                pass

        container_state.execution_history.new_execution_command_handled = True

        # in the case that the stop method wakes up the paused or step mode a StateMachineExecutionStatus.STOPPED
        # will be returned
        return_value = self._status.execution_mode

        return return_value