import re


def get_results_dir(output_list):
    """Given output from acme_diags_driver, extract the path to results_dir."""
    for line in output_list:
        match = re.search('Viewer HTML generated at (.*)viewer.*.html', line)
        if match:
            results_dir = match.group(1)
            return results_dir
    message = 'No viewer directory listed in output: {}'.format(output_list)
    raise RuntimeError(message)