'Returns all the visible profiles available to this user.
For now keeps it simple by just applying the cases when a user is not
active, a user has it\'s profile closed to everyone or a user only
allows registered users to view their profile.
:param user:
A Django :class:`User` instance.
:return:
All profiles that are visible to this user.'

def get_visible_profiles(self, user=None):

    profiles = self.all()
    filter_kwargs = {'user__is_active': True}
    profiles = profiles.filter(**filter_kwargs)
    if (user and isinstance(user, AnonymousUser)):
        profiles = profiles.exclude((Q(privacy='closed') | Q(privacy='registered')))
    else:
        profiles = profiles.exclude(Q(privacy='closed'))
    return profiles
