def clean(self, value):
        super(CHIdentityCardNumberField, self).clean(value)
        if value in EMPTY_VALUES:
            return ''

        match = re.match(id_re, value)
        if not match:
            raise ValidationError(self.error_messages['invalid'])

        result = match.groupdict()
        idnumber, pos9, checksum = result['idnumber'], result['pos9'], result['checksum']

        if (idnumber == '00000000' or
                idnumber == 'A0000000'):
            raise ValidationError(self.error_messages['invalid'])

        all_digits = "%s%s%s" % (idnumber, pos9, checksum)
        if not self.has_valid_checksum(all_digits):
            raise ValidationError(self.error_messages['invalid'])

        return '%s%s%s' % (idnumber, pos9, checksum)
dataset/ETHPy150Open django/django-localflavor/localflavor/ch/forms.py/CHIdentityCardNumberField.clean/original