def get_global_notification_type(global_subscription, user):
 for notification_type in constants.NOTIFICATION_TYPES:
  if getattr(global_subscription, notification_type).filter(id=user.id).exists():
   return notification_type

def get_global_notification_type ( global_subscription , user ) : for notification_type in constants . NOTIFICATION_TYPES : if getattr ( global_subscription , notification_type ) . filter ( id = user . id ) . exists ( ) : return notification_type
given a global subscription .