@register.filter
def html2text(value):
    """
    Pipes given HTML string into the text browser W3M, which renders it.
    Rendered text is grabbed from STDOUT and returned.
    """
    try:
        cmd = "w3m -dump -T text/html -O utf-8"
        proc = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, universal_newlines=True)
        return proc.communicate(str(value))[0]
    except __HOLE__:
        # something bad happened, so just return the input
        return value
dataset/ETHPy150Open ramusus/django-email-html/email_html/templatetags/email_html.py/html2text