def _from_native_list(self, condition_list):
        '''
        These arrive in one of three formats:
          - ["content-length-range", 1048579, 10485760]
          - ["content-length-range", 1024]
          - ["starts-with", "$key", "user/eric/"]

        Returns an object with these attributes set:
          - operator: 'eq', 'starts-with', or None
          - element_name: 'content-length-range', 'key', etc.
          - value: "user/eric/", 1024, or None
          - value_range: [1048579, 10485760] or None
        '''
        from numbers import Number
        from drf_to_s3.models import PolicyCondition
        original_condition_list = condition_list # We use this for error reporting
        condition_list = list(condition_list)
        for item in condition_list:
            if not isinstance(item, basestring) and not isinstance(item, Number):
                raise ValidationError(
                    _('Values in condition arrays should be numbers or strings'),
                )
        try:
            if condition_list[0] in ['eq', 'starts-with']:
                operator = condition_list.pop(0)
            else:
                operator = None
        except IndexError:
            raise ValidationError(
                _('Empty condition array: %(condition)s'),
                params={'condition': original_condition_list},
            )
        try:
            element_name = condition_list.pop(0)
        except __HOLE__:
            raise ValidationError(
                _('Missing element in condition array: %(condition)s'),
                params={'condition': original_condition_list},
            )
        if operator:
            if element_name.startswith('$'):
                element_name = element_name[1:]
            else:
                raise ValidationError(
                    _('Element name in condition array should start with $: %(element_name)s'),
                    params={'element_name': element_name},
                )
        if len(condition_list) == 0:
            raise ValidationError(
                _('Missing values in condition array: %(condition)s'),
                params={'condition': original_condition_list},
            )
        elif len(condition_list) == 1:
            value = condition_list.pop(0)
            value_range = None
        elif len(condition_list) == 2:
            value = None
            value_range = condition_list
        else:
            raise ValidationError(
                _('Too many values in condition array: %(condition)s'),
                params={'condition': original_condition_list},
            )
        return PolicyCondition(
            operator=operator,
            element_name=element_name,
            value=value,
            value_range=value_range
        )
dataset/ETHPy150Open bodylabs/drf-to-s3/drf_to_s3/naive_serializers.py/NaivePolicyConditionField._from_native_list