<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_execution_mode(self, execution_mode, notify=True):
 """ An observed setter for the execution mode of the state machine status. This is necessary for the monitoring client to update the local state machine in the same way as the root state machine of the server. :param execution_mode: the new execution mode of the state machine :raises exceptions.TypeError: if the execution mode is of the wrong type """

        if not isinstance(execution_mode, StateMachineExecutionStatus):
            raise TypeError("status must be of type StateMachineExecutionStatus")
        self._status.execution_mode = execution_mode
        if notify:
            self._status.execution_condition_variable.acquire()
            self._status.execution_condition_variable.notify_all()
            self._status.execution_condition_variable.release()