def format_user_subscriptions(user):
 user_subs_available = list(constants.USER_SUBSCRIPTIONS_AVAILABLE.keys())
 subscriptions = [serialize_event(user, subscription, event_description=user_subs_available.pop(user_subs_available.index(getattr(subscription, 'event_name')))) for subscription in get_all_user_subscriptions(user) if ((subscription is not None) and (getattr(subscription, 'event_name') in user_subs_available))]
 subscriptions.extend([serialize_event(user, event_description=sub) for sub in user_subs_available])
 return subscriptions

def format_user_subscriptions ( user ) : user_subs_available = list ( constants . USER_SUBSCRIPTIONS_AVAILABLE . keys ( ) ) subscriptions = [ serialize_event ( user , subscription , event_description = user_subs_available . pop ( user_subs_available . index ( getattr ( subscription , 'event_name' ) ) ) ) for subscription in get_all_user_subscriptions ( user ) if ( ( subscription is not None ) and ( getattr ( subscription , 'event_name' ) in user_subs_available ) ) ] subscriptions . extend ( [ serialize_event ( user , event_description = sub ) for sub in user_subs_available ] ) return subscriptions
format user-level subscriptions for user settings page .