from stripogram import html2text, html2safehtml
mylumpofdodgyhtml
mylumpofcoolcleancollectedhtml = html2safehtml(mylumpofdodgyhtml,
    valid_tags=('b', 'a', 'i', 'br', 'p'))
mylumpoftext = html2text(mylumpofcoolcleancollectedhtml, ignore_tags=('img'
    ,), indent_width=4, page_width=80)
Библиотека Python для фильтрации XSS?