def update_email_preferences(user_id, can_receive_email_updates, can_receive_editor_role_email, can_receive_feedback_email, can_receive_subscription_email):
 email_preferences_model = user_models.UserEmailPreferencesModel.get(user_id, strict=False)
 if (email_preferences_model is None):
  email_preferences_model = user_models.UserEmailPreferencesModel(id=user_id)
 email_preferences_model.site_updates = can_receive_email_updates
 email_preferences_model.editor_role_notifications = can_receive_editor_role_email
 email_preferences_model.feedback_message_notifications = can_receive_feedback_email
 email_preferences_model.subscription_notifications = can_receive_subscription_email
 email_preferences_model.put()

def update_email_preferences ( user_id , can_receive_email_updates , can_receive_editor_role_email , can_receive_feedback_email , can_receive_subscription_email ) : email_preferences_model = user_models . UserEmailPreferencesModel . get ( user_id , strict = False ) if ( email_preferences_model is None ) : email_preferences_model = user_models . UserEmailPreferencesModel ( id = user_id ) email_preferences_model . site_updates = can_receive_email_updates email_preferences_model . editor_role_notifications = can_receive_editor_role_email email_preferences_model . feedback_message_notifications = can_receive_feedback_email email_preferences_model . subscription_notifications = can_receive_subscription_email email_preferences_model . put ( )
updates whether the user has chosen to receive email updates .