def do_set_user_display_setting(user_profile: UserProfile, setting_name: str, setting_value: Union[(bool, str, int)]) -> None:
    property_type = UserProfile.property_types[setting_name]
    assert isinstance(setting_value, property_type)
    setattr(user_profile, setting_name, setting_value)
    user_profile.save(update_fields=[setting_name])
    event = {'type': 'update_display_settings', 'user': user_profile.email, 'setting_name': setting_name, 'setting': setting_value}
    if (setting_name == 'default_language'):
        assert isinstance(setting_value, str)
        event['language_name'] = get_language_name(setting_value)
    send_event(user_profile.realm, event, [user_profile.id])
    if (setting_name == 'timezone'):
        payload = dict(email=user_profile.email, user_id=user_profile.id, timezone=user_profile.timezone)
        send_event(user_profile.realm, dict(type='realm_user', op='update', person=payload), active_user_ids(user_profile.realm_id))
def do_set_user_display_setting(user_profile: UserProfile, setting_name: str, setting_value: Union[(bool, str, int)]) -> None:
    property_type = UserProfile.property_types[setting_name]
    assert isinstance(setting_value, property_type)
    setattr(user_profile, setting_name, setting_value)
    user_profile.save(update_fields=[setting_name])
    event = {'type': 'update_display_settings', 'user': user_profile.email, 'setting_name': setting_name, 'setting': setting_value}
    if (setting_name == 'default_language'):
        assert isinstance(setting_value, str)
        event['language_name'] = get_language_name(setting_value)
    send_event(user_profile.realm, event, [user_profile.id])
    if (setting_name == 'timezone'):
        payload = dict(email=user_profile.email, user_id=user_profile.id, timezone=user_profile.timezone)
        send_event(user_profile.realm, dict(type='realm_user', op='update', person=payload), active_user_ids(user_profile.realm_id))