def add_newlines(tree):
    """
    Add a newline character to the end of each <br> element.
    """
    for br in tree.xpath("*//br"):
        br.tail = u"\n" + br.tail if br.tail else u"\n"
Add a newline character to the end of each <br> element.