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']:
        pass
Parsing HTML into sentences - how to handle tables/lists/headings/etc?