'Special privacy aware __getattribute__ method.
This method returns the real value of the attribute of object,
if the privacy_level of the attribute is at least as large as
the _privacy_level attribute.
Otherwise it returns a default privacy respecting value for
the attribute, as defined in the privacy_fields dictionary.
special_functions provides methods that privacy safe their
respective properties, where the privacy modifications are
more complex.'

def __getattribute__(self, attrname):

    _getattr = (lambda x: super(UserProfile, self).__getattribute__(x))
    privacy_fields = UserProfile.privacy_fields()
    privacy_level = _getattr('_privacy_level')
    special_functions = {'accounts': '_accounts', 'alternate_emails': '_alternate_emails', 'email': '_primary_email', 'is_public_indexable': '_is_public_indexable', 'languages': '_languages', 'vouches_made': '_vouches_made', 'vouches_received': '_vouches_received', 'vouched_by': '_vouched_by', 'websites': '_websites'}
    if (attrname in special_functions):
        return _getattr(special_functions[attrname])
    if ((not privacy_level) or (attrname not in privacy_fields)):
        return _getattr(attrname)
    field_privacy = _getattr(('privacy_%s' % attrname))
    if (field_privacy < privacy_level):
        return privacy_fields.get(attrname)
    return _getattr(attrname)
