<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def flush(self):
 """ Wait until history is read but no more than 10 cycles in case a browser session is closed. """

        i = 0
        while self._frame_data.is_dirty and i < 10:
            i += 1
            time.sleep(0.1)