'Given a list of files, find the most likely root HTML file in the
list.'

@classmethod
def find_html_index(self, files):

    html_pat = re.compile('\\.(x){0,1}htm(l){0,1}$', re.IGNORECASE)
    html_files = [f for f in files if (html_pat.search(f) is not None)]
    if (not html_files):
        raise ValueError(_('Could    not    find    an    e-book    inside    the    archive'))
    html_files = [(f, os.stat(f).st_size) for f in html_files]
    html_files.sort(cmp=(lambda x, y: cmp(x[1], y[1])))
    html_files = [f[0] for f in html_files]
    for q in ('toc', 'index'):
        for f in html_files:
            if (os.path.splitext(os.path.basename(f))[0].lower() == q):
                return (f, os.path.splitext(f)[1].lower()[1:])
    return (html_files[(-1)], os.path.splitext(html_files[(-1)])[1].lower()[1:])
