def interact_in_memory(client_conn, server_conn):
    '\n    Try to read application bytes from each of the two `Connection` objects.\n    Copy bytes back and forth between their send/receive buffers for as long\n    as there is anything to copy.  When there is nothing more to copy,\n    return `None`.  If one of them actually manages to deliver some application\n    bytes, return a two-tuple of the connection from which the bytes were read\n    and the bytes themselves.\n    '
    wrote = True
    while wrote:
        wrote = False
        for (read, write) in [(client_conn, server_conn), (server_conn, client_conn)]:
            try:
                data = read.recv((2 ** 16))
            except WantReadError:
                pass
            else:
                return (read, data)
            while True:
                try:
                    dirty = read.bio_read(4096)
                except WantReadError:
                    break
                else:
                    wrote = True
                    write.bio_write(dirty)
Try to read application bytes from each of the two `Connection` objects.
Copy bytes back and forth between their send/receive buffers for as long
as there is anything to copy.  When there is nothing more to copy,
return `None`.  If one of them actually manages to deliver some application
bytes, return a two-tuple of the connection from which the bytes were read
and the bytes themselves.
def interact_in_memory(client_conn, server_conn):
    '\n    Try to read application bytes from each of the two `Connection` objects.\n    Copy bytes back and forth between their send/receive buffers for as long\n    as there is anything to copy.  When there is nothing more to copy,\n    return `None`.  If one of them actually manages to deliver some application\n    bytes, return a two-tuple of the connection from which the bytes were read\n    and the bytes themselves.\n    '
    wrote = True
    while wrote:
        wrote = False
        for (read, write) in [(client_conn, server_conn), (server_conn, client_conn)]:
            try:
                data = read.recv((2 ** 16))
            except WantReadError:
                pass
            else:
                return (read, data)
            while True:
                try:
                    dirty = read.bio_read(4096)
                except WantReadError:
                    break
                else:
                    wrote = True
                    write.bio_write(dirty)