def discard_empty_elements(soup, exempt=()):
    """Remove HTML elements that have no/whitespace-only content"""
    for tag in soup.find_all():
        if len(tag.get_text(strip=True)) == 0 and tag.name not in exempt:
            tag.extract()
    return soup