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

        if not re.match(r'^\d{12}$', value):
            raise ValidationError(self.error_messages['invalid'])

        match = re.match(id_re, value)

        if not match:
            raise ValidationError(self.error_messages['invalid'])

        gd = match.groupdict()

        try:
            d = date(int(gd['yy']), int(gd['mm']), int(gd['dd']))
        except __HOLE__:
            raise ValidationError(self.error_messages['invalid'])

        if not self.has_valid_checksum(value):
            raise ValidationError(self.error_messages['invalid'])

        return value
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/contrib/localflavor/kw/forms.py/KWCivilIDNumberField.clean