human
Complete this python program:
def debug_ssh(function):
assistant
#Here is the Python program you requested.

    """Decorator to generate extra debug info in case off SSH failure
    """
    def wrapper(self, *args, **kwargs):
        try:
            return function(self, *args, **kwargs)
        except Exception as e:
            caller = (test_utils.find_test_caller() or 'not    found')
            if (not isinstance(e, tempest.lib.exceptions.SSHTimeout)):
                message = ('Initializing    SSH    connection    to    %(ip)s    failed.    Error:    %(error)s' % {'ip': self.ip_address, 'error': e})
                message = ('(%s)    %s' % (caller, message))
                LOG.error(message)
                raise
            else:
                try:
                    original_exception = sys.exc_info()
                    if self.server:
                        msg = 'Caller:    %s.    Timeout    trying    to    ssh    to    server    %s'
                        LOG.debug(msg, caller, self.server)
                        if (self.console_output_enabled and self.servers_client):
                            try:
                                msg = 'Console    log    for    server    %s:    %s'
                                console_log = self.servers_client.get_console_output(self.server['id'])['output']
                                LOG.debug(msg, self.server['id'], console_log)
                            except Exception:
                                msg = 'Could    not    get    console_log    for    server    %s'
                                LOG.debug(msg, self.server['id'])
                    six.reraise(*original_exception)
                finally:
                    (_, _, trace) = original_exception
                    del trace
    return wrapper