def extract_text(escaped_html_str):
    notes = xml.sax.saxutils.unescape(escaped_html_str)
    try:
        from PyQt4 import QtGui
    except __HOLE__:
        return str(notes)
    else:
        fragment = QtGui.QTextDocumentFragment.fromHtml(notes)
        return str(fragment.toPlainText())

# The queries are old and are preserved for reference.  Some code is
# quite old (references to vis_application, for example).
dataset/ETHPy150Open VisTrails/VisTrails/vistrails/core/query/__init__.py/extract_text