def validate_username(self, value):
        try:
            User.objects.get(username=value)
        except User.DoesNotExist:
            raise ValidationError(_(u"User '%(value)s' does not exist."
                                    % {"value": value}))

        return value
Check that the username exists
dataset/ETHPy150Open kobotoolbox/kobocat/onadata/libs/serializers/share_project_serializer.py/ShareProjectSerializer.validate_username