def _setattr_default(obj, attr, value, default):
    """Set an attribute of an object to a value or default value."""
    if value is None:
        setattr(obj, attr, default)
    else:
        setattr(obj, attr, value)
