import time


def send_command(remote_conn, cmd="", delay=1):
    """
    Send command down the channel. Retrieve and return the output.
    """

    MAX_BUFFER=65000
    if cmd != "":
        cmd = cmd.strip()
    remote_conn.send(cmd + '\n')
    time.sleep(delay)

    if remote_conn.recv_ready():
        return remote_conn.recv(MAX_BUFFER)
    else:
        return ""