def stripIt(s):
    doc = lxml.html.fromstring(s)
txt = doc.xpath('text()')
txt = ' '.join(txt)
return re.sub('\\s+', ' ', txt)
s = 'foo <SOME_VALID_HTML_TAG> something </SOME_VALID_HTML_TAG> bar'
stripIt(s)
Python: strip html from text data