from typing import Any


def set_attribute(obj: Any, attr: str, new_value: Any) -> bool:
    """ Set an attribute of an object to a specific value, if it wasn't that already.
        Return True if the attribute was changed and False otherwise.
    """
    if not hasattr(obj, attr):
        setattr(obj, attr, new_value)
        return True
    if new_value != getattr(obj, attr):
        setattr(obj, attr, new_value)
        return True
    return False