@library.global_function
def karma_titles(user):
 return Title.objects.filter((Q(users=user) | Q(groups__in=user.groups.all()))).distinct()

@ library . global_function def karma_titles ( user ) : return Title . objects . filter ( ( Q ( users = user ) | Q ( groups__in = user . groups . all ( ) ) ) ) . distinct ( )
return a list of titles for a given user .