<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _pre_tidy(html):
 """ This method transforms a few things before tidy runs. When we get rid of tidy, this can go away. """

    tree = etree.fromstring(html, etree.HTMLParser())
    for el in tree.xpath('//u'):
        el.tag = 'em'
        c = el.attrib.get('class', '').split()
        if 'underline' not in c:
            c.append('underline')
            el.attrib['class'] = ' '.join(c)

    return tohtml(tree)