def validate_condition_key(self, condition):
        from .util import string_contains_only_url_characters
        if not isinstance(condition.value, basestring):
            raise ValidationError(
                _('Key should be a string'),
            )
        elif len(condition.value.decode('utf-8')) > 1024:
            raise ValidationError(
                _('Key too long'),
            )
        if not string_contains_only_url_characters(condition.value):
            raise ValidationError(
                _('Invalid character in key'),
            )
Require that key is a string consisting only of URL characters
dataset/ETHPy150Open bodylabs/drf-to-s3/drf_to_s3/serializers.py/DefaultPolicySerializer.validate_condition_key