def sanitize(element):
    """Retrieve all the text contained in an element as a single line of
    text. This must be executed only on blocks that have only inlines
    as children
    """
out = ' '.join(element.itertext()).replace('\n', ' ')
out = ' '.join(out.split())
return out

def parse(element):
    if element.tag in ['div', 'li', 'a', 'body', 'ul']:
        if element.text is None or element.text.isspace():
            for child in element.getchildren():
                pass
Разбор HTML в предложения - как обрабатывать таблицы/списки/заголовки/и т. д.?