<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_flush_immediately(self, flush_immediately: Optional[bool]=True)\ -> 'BaseTensorBoardTask': """ Sets the flag indicating that the event file should be flushed at each call. """

        self._flush_immediately = flush_immediately
        return self