human
What is a Python code to print ('[%s]    rtunnel:    cannot    connect    to    %s:%d    (from    local)' % (env given the following:
I wrote the below code

    if (local_port is None):
        local_port = remote_port
    sockets = []
    channels = []
    threads = []
    def accept(channel, (src_addr, src_port), (dest_addr, dest_port)):
        channels.append(channel)
        sock = socket.socket()
        sockets.append(sock)
        try:
            sock.connect((local_host, local_port))
        except Exception:
            print ('[%s]    rtunnel:    cannot    connect    to    %s:%d    (from    local)' % (env.host_string, local_host, local_port))
            channel.close()
            return
        print ('[%s]    rtunnel:    opened    reverse    tunnel:    %r    ->    %r    ->    %r' % (env.host_string, channel.origin_addr, channel.getpeername(), (local_host, local_port)))
        th = ThreadHandler('fwd', _forwarder, channel, sock)
        threads.append(th)
    transport = connections[env.host_string].get_transport()
    transport.request_port_forward(remote_bind_address, remote_port, handler=accept)
    try:
        (yield)
    finally:
        for (sock, chan, th) in zip(sockets, channels, threads):
            sock.close()
            chan.close()
            th.thread.join()
            th.raise_if_needed()
        transport.cancel_port_forward(remote_bind_address, remote_port)

What's a good function header?
assistant
#Here is Python code to print ('[%s]    rtunnel:    cannot    connect    to    %s:%d    (from    local)' % (env.

@documented_contextmanager
def remote_tunnel(remote_port, local_port=None, local_host='localhost', remote_bind_address='127.0.0.1'):