def _sanitize_text(text):
    """ Cleans up line and paragraph breaks in `text`
    """

    text = ' '.join(text.replace('\n', ' ').split())
    return text.replace('<br> ', '\n\n') \
               .replace('<p>', '\n')