<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _run_popen(command, print_output=False):
 """ subprocess has the most terrible interface ever. Envoy is an option but too heavyweight for this. This is a convenience wrapper around subprocess.Popen. Also, this merges STDOUT and STDERR together, since there isn't a good way of interleaving them without threads. """

    output = ''
    po = subprocess.Popen(
        command,
        stdout=subprocess.PIPE,
        stderr=subprocess.STDOUT,
    )
    fcntl.fcntl(
        po.stdout.fileno(),
        fcntl.F_SETFL,
        fcntl.fcntl(po.stdout.fileno(), fcntl.F_GETFL) | os.O_NONBLOCK,
    )
    while po.poll() is None:
        stream = po.stdout
        readx = select.select([stream.fileno()], [], [])[0]
        if readx:
            chunk = stream.read()
            output += chunk
            if print_output:
                print chunk
    return Result(output, po.returncode)