<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def rprint(sep='\n', end='\n', file=sys.stdout, flush=False):
 """A coroutine sink which prints received items stdout Args: sep: Optional separator to be printed between received items. end: Optional terminator to be printed after the last item. file: Optional stream to which to print. flush: Optional flag to force flushing after each item. """

    try:
        first_item = (yield)
        file.write(str(first_item))
        if flush:
            file.flush()
        while True:
            item = (yield)
            file.write(sep)
            file.write(str(item))
            if flush:
                file.flush()
    except GeneratorExit:
        file.write(end)
        if flush:
            file.flush()