def _from_native_list(self, condition_list):
        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 IndexError:
            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
        )
Tests if can reset an ip address
dataset/ETHPy150Open bodylabs/drf-to-s3/drf_to_s3/naive_serializers.py/NaivePolicyConditionField._from_native_list--crossover with--dataset/ETHPy150Open kencochrane/django-defender/defender/tests.py/AccessAttemptTest.test_reset_ip