@intercept_errors(UserAPIInternalError, ignore_errors=[UserAPIRequestError])
def set_user_preference(requesting_user, preference_key, preference_value, username=None):
 existing_user = _get_authorized_user(requesting_user, username)
 serializer = create_user_preference_serializer(existing_user, preference_key, preference_value)
 validate_user_preference_serializer(serializer, preference_key, preference_value)
 try:
  serializer.save()
 except Exception as error:
  raise _create_preference_update_error(preference_key, preference_value, error)

@ intercept_errors ( UserAPIInternalError , ignore_errors = [ UserAPIRequestError ] ) def set_user_preference ( requesting_user , preference_key , preference_value , username = None ) : existing_user = _get_authorized_user ( requesting_user , username ) serializer = create_user_preference_serializer ( existing_user , preference_key , preference_value ) validate_user_preference_serializer ( serializer , preference_key , preference_value ) try : serializer . save ( ) except Exception as error : raise _create_preference_update_error ( preference_key , preference_value , error )
update a user preference for the given username .