<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 async def pipe_to_log(pipe, filehandles=(), level=logging.INFO):
 """Log from a subprocess PIPE. Args: pipe (filehandle):
 subprocess process STDOUT or STDERR filehandles (list of filehandles, optional):
 the filehandle(s) to write to. If empty, don't write to a separate file. Defaults to (). level (int, optional):
 the level to log to. Defaults to ``logging.INFO``. """

    while True:
        line = await pipe.readline()
        if line:
            line = to_unicode(line)
            log.log(level, line.rstrip())
            for filehandle in filehandles:
                print(line, file=filehandle, end="")
        else:
            break