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

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

        day, month, year, century, check = map(int, match.groups())

        if check != self.lv_checksum(value[0:6] + value[7:11]):
            raise ValidationError(self.error_messages['invalid'])

        year += 1800 + 100 * century
        try:
            date(year, month, day)
        except __HOLE__:
            raise ValidationError(self.error_messages['invalid'])

        return value
dataset/ETHPy150Open django/django-localflavor/localflavor/lv/forms.py/LVPersonalCodeField.clean