'Wait until the remote host is down or the timeout expires.
If old_boot_id is provided, this will wait until either the machine
is unpingable or self.get_boot_id() returns a value different from
old_boot_id. If the boot_id value has changed then the function
returns true under the assumption that the machine has shut down
and has now already come back up.
If old_boot_id is None then until the machine becomes unreachable the
method assumes the machine has not yet shut down.
:param timeout Time limit in seconds before returning even
if the host is still up.
:param warning_timer Time limit in seconds that will generate
a warning if the host is not down yet.
:param old_boot_id A string containing the result of self.get_boot_id()
prior to the host being told to shut down. Can be None if this is
not available.
:return: True if the host was found to be down, False otherwise'

def wait_down(self, timeout=None, warning_timer=None, old_boot_id=None):

    current_time = time.time()
    if timeout:
        end_time = (current_time + timeout)
    if warning_timer:
        warn_time = (current_time + warning_timer)
    if (old_boot_id is not None):
        logging.debug('Host    %s    pre-shutdown    boot_id    is    %s', self.hostname, old_boot_id)
    while ((not timeout) or (current_time < end_time)):
        try:
            new_boot_id = self.get_boot_id()
        except error.AutoservError:
            logging.debug('Host    %s    is    now    unreachable    over    ssh,    is    down', self.hostname)
            return True
        else:
            if ((old_boot_id is not None) and (old_boot_id != new_boot_id)):
                logging.debug('Host    %s    now    has    boot_id    %s    and    so    must    have    rebooted', self.hostname, new_boot_id)
                return True
        if (warning_timer and (current_time > warn_time)):
            self.record('WARN', None, 'shutdown', ('Shutdown    took    longer    than    %ds' % warning_timer))
            warning_timer = None
            self.run('kill    -HUP    1', ignore_status=True)
        time.sleep(1)
        current_time = time.time()
    return False
