def _update_attr(attr_name, old_obj, new_obj):
    """ Update an object if necessary. Return True if updated. """
    old_value = getattr(old_obj, attr_name)
    new_value = getattr(new_obj, attr_name)
    if new_value != old_value and new_value is not None:
        setattr(old_obj, attr_name, new_value)
        return True
