<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def wait_for_taskresult(task_result, content, interval, max_rounds):
 """Get helper to wait for async task result to finish. The task will periodically send whitespace to prevent the connection from being closed. :param task_result: The async task to wait for. :param content: The content to return when the task is ready. :param interval: The duration of a sleep period before check again if the task is ready. :param max_rounds: The maximum number of intervals the function check before returning an Exception. :returns: An iterator on the content or a :class:`invenio_files_rest.errors.FilesException` exception if the timeout happened or the job failed. """

    assert max_rounds > 0

    def _whitespace_waiting():
        current = 0
        while current < max_rounds and current != -1:
            if task_result.ready():
                # Task is done and we return
                current = -1
                if task_result.successful():
                    yield content
                else:
                    yield FilesException(
                        description='Job failed.'
                    ).get_body()
            else:
                # Send whitespace to prevent connection from closing.
                current += 1
                sleep(interval)
                yield b' '

        # Timed-out reached
        if current == max_rounds:
            yield FilesException(
                description='Job timed out.'
            ).get_body()

    return _whitespace_waiting()