def validate(self, attrs):
        '''
        1. Disallow multiple conditions with the same element name
        2. Use introspection to validate individual conditions which are present.
        '''
        from .util import duplicates_in
        conditions = attrs.get('conditions', [])
        errors = {}
        all_names = [item.element_name for item in conditions]
        for name in duplicates_in(all_names):
            message = _('Duplicate element name')
            errors['conditions.' + name] = [message]
        for item in conditions:
            # FIXME this needs to sanitize the arguments a bit more
            # validate_condition_Content-Type -> validate_condition_Content_Type
            sanitized_element_name = item.element_name.replace('-', '_')
            condition_validate = getattr(self, "validate_condition_%s" % sanitized_element_name, None)
            if condition_validate:
                try:
                    condition_validate(item)
                except __HOLE__ as err:
                    field_name = 'conditions.' + item.element_name
                    errors[field_name] = errors.get(field_name, []) + list(err.messages)
        if len(errors):
            raise ValidationError(errors)
        else:
            return attrs
dataset/ETHPy150Open bodylabs/drf-to-s3/drf_to_s3/naive_serializers.py/NaivePolicySerializer.validate