def setattr_if_none(obj, attr, default):
    """Set attribute as `default` if None

    :returns: attribute value after update
    """
    if getattr(obj, attr) is None:
        setattr(obj, attr, default)
    return getattr(obj, attr)
