<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_condition(self, condition: Callable[[MonitorContext], bool]) -> 'MonitorTask': """ Sets the task running condition that will be evaluated during the optimisation cycle. """

        self._condition = condition
        return self