<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def with_exit_condition(self, exit_condition: Optional[bool]=True) -> 'MonitorTask': """ Sets the flag indicating that the task should also run after the optimisation is ended. """

        self._exit_condition = exit_condition
        return self