def METHOD_NAME(self):
    """Wait until the instance is ready to accept ssh commands."""
    self.instance.wait_until_running()
    self.instance.reload()
    print('Started VM %s "%s" at %s'%(self.instance.id, self.distro_name, self.instance.public_ip_address), file=sys.stderr)
    for retries in range(30):
        result = subprocess.run(self.ssh_command() + ['true'], stdin=subprocess.DEVNULL, stderr=subprocess.PIPE)
        if result.returncode == 0:
            self.ssh_ready = True
            break
        if b'Connection refused' not in result.stderr:
            raise Exception('SSH connection failed:\n%s'%result.stderr.decode('utf-8'))
        time.sleep(1)