def _proc_iteroutput_thread(proc):
from six.moves import queue<EOL>stdout_queue = _proc_async_iter_stream(proc, proc.stdout)<EOL>stderr_queue = _proc_async_iter_stream(proc, proc.stderr)<EOL>stdout_live = True<EOL>stderr_live = True<EOL>while stdout_live or stderr_live:<EOL><INDENT>if stdout_live:  <EOL><INDENT>try:<EOL><INDENT>oline = stdout_queue.get_nowait()<EOL>stdout_live = oline is not None<EOL><DEDENT>except queue.Empty:<EOL><INDENT>oline = None<EOL><DEDENT><DEDENT>if stderr_live:<EOL><INDENT>try:<EOL><INDENT>eline = stderr_queue.get_nowait()<EOL>stderr_live = eline is not None<EOL><DEDENT>except queue.Empty:<EOL><INDENT>eline = None<EOL><DEDENT><DEDENT>if oline is not None or eline is not None:<EOL><INDENT>yield oline, eline<EOL><DEDENT><DEDENT>
Iterates over output from a process line by line

Note:
    WARNING. Current implementation might have bugs with other threads.
    This behavior was seen when using earlier versions of tqdm. I'm not
    sure if this was our bug or tqdm's. Newer versions of tqdm fix this,
    but I cannot guarantee that there isn't an issue on our end.

Yields:
    Tuple[str, str]: oline, eline: stdout and stderr line

References:
    https://stackoverflow.com/questions/375427/non-blocking-read-subproc