'Run a command on the remote host.
@see shared.hosts.host.run()
:param connect_timeout: connection timeout (in seconds)
:param options: string with additional ssh command options
:param verbose: log the commands
:raise AutoservRunError: if the command failed
:raise AutoservSSHTimeout: ssh connection has timed out'

def run(self, command, timeout=3600, ignore_status=False, stdout_tee=utils.TEE_TO_LOGS, stderr_tee=utils.TEE_TO_LOGS, connect_timeout=30, stdin=None, verbose=True, args=()):

    stdout = utils.get_stream_tee_file(stdout_tee, utils.DEFAULT_STDOUT_LEVEL, prefix=utils.STDOUT_PREFIX)
    stderr = utils.get_stream_tee_file(stderr_tee, utils.get_stderr_level(ignore_status), prefix=utils.STDERR_PREFIX)
    for arg in args:
        command += ('    "%s"' % utils.sh_escape(arg))
    if verbose:
        logging.debug(("Running    (ssh-paramiko)    '%s'" % command))
    start_time = time.time()
    try:
        channel = self._open_channel(timeout)
        channel.exec_command(command)
    except (socket.error, paramiko.SSHException, EOFError) as e:
        if (str(e) != 'Channel    closed.'):
            raise error.AutoservSSHTimeout(('ssh    failed:    %s' % e))
    (raw_stdout, raw_stderr) = ([], [])
    timed_out = False
    while (not channel.exit_status_ready()):
        if channel.recv_ready():
            raw_stdout.append(channel.recv(self.BUFFSIZE))
            stdout.write(raw_stdout[(-1)])
        if channel.recv_stderr_ready():
            raw_stderr.append(channel.recv_stderr(self.BUFFSIZE))
            stderr.write(raw_stderr[(-1)])
        if (timeout and ((time.time() - start_time) > timeout)):
            timed_out = True
            break
        stdin = self.__send_stdin(channel, stdin)
        time.sleep(1)
    if timed_out:
        exit_status = (- signal.SIGTERM)
    else:
        exit_status = channel.recv_exit_status()
    channel.settimeout(10)
    self._exhaust_stream(stdout, raw_stdout, channel.recv)
    self._exhaust_stream(stderr, raw_stderr, channel.recv_stderr)
    channel.close()
    duration = (time.time() - start_time)
    stdout = ''.join(raw_stdout)
    stderr = ''.join(raw_stderr)
    result = utils.CmdResult(command, stdout, stderr, exit_status, duration)
    if (exit_status == (- signal.SIGHUP)):
        msg = 'ssh    connection    unexpectedly    terminated'
        raise error.AutoservRunError(msg, result)
    if timed_out:
        logging.warn('Paramiko    command    timed    out    after    %s    sec:    %s', timeout, command)
        raise error.AutoservRunError('command    timed    out', result)
    if ((not ignore_status) and exit_status):
        raise error.AutoservRunError(command, result)
    return result
