def delete_duplicate_br(doc, maxnum=2):
    """Continuous ``<br>`` tags to maximum ``<br>``, to save display space.

    >>> el = fromstring('<div>aaa<br><br>  <br><br/><br>bbb<br><br></div>')
    >>> delete_duplicate_br(el)
    >>> tostring(el)
    '<div>aaa<br><br>  bbb<br><br></div>'
    """
    num = 0
    _remove = []
    for el in doc.iter():
        if el.tag == 'br':
            num += 1
            if num > maxnum:
                _remove.append(el)
            if el.tail is None or el.tail.strip() == '':
                num = min(num, maxnum)
            else:
                num = 0
        else:
            num = 0
    for el in list(_remove):
        el.drop_tag()
