def _html2text(html): sio = StringIO() html2text.html2text_file(html, sio.write) text = sio.getvalue() sio.close() return text