'Find where the Autotest client is installed on the host.
:return: an absolute path to an installed Autotest client root.
:raise AutodirNotFoundError if no Autotest installation can be found.'

@classmethod
def get_installed_autodir(cls, host):

    autodir = host.get_autodir()
    if autodir:
        logging.debug('Using    existing    host    autodir:    %s', autodir)
        return autodir
    if (not _server_system_wide_install()):
        for path in Autotest.get_client_autodir_paths(host):
            try:
                autotest_binary = os.path.join(path, CLIENT_BINARY)
                host.run(('test    -x    %s' % utils.sh_escape(autotest_binary)))
                host.run(('test    -w    %s' % utils.sh_escape(path)))
                logging.debug('Found    existing    autodir    at    %s', path)
                return path
            except error.AutoservRunError:
                logging.debug('%s    does    not    exist    on    %s', autotest_binary, host.hostname)
    else:
        for path in Autotest.get_client_autodir_paths(host):
            host.run(('test    -w    %s' % utils.sh_escape(path)))
            logging.debug('Found    existing    autodir    at    %s', path)
            host.autodir = path
            return path
    raise AutodirNotFoundError
