def _required_attribute(element, name, default):
    """
    Add attribute with default value to element if it doesn't already exist.
    """
    if element.get(name) is None:
        element.set(name, default)