def html_to_plain_text(html):
    # Use BeautifulSoup to normalize the html
    soup = BeautifulSoup(html, "html.parser")
    # Init the parser
    parser = HTML2PlainParser()
    parser.feed(str(soup))
    # Strip the end of the plain text
    result = parser.text.rstrip()
    # Add footnotes
    if parser.links:
        result += '\n\n'
        for link in parser.links:
            result += '[{}]: {}\n'.format(link[0], link[1])
    return result
Converts html code into formatted plain text.
dataset/ETHPy150Open bitmazk/django-libs/django_libs/utils/converter.py/html_to_plain_text