'This function would grab the birthdate from the ID card number and test
whether it is a valid date.'

def has_valid_birthday(self, value):

    from datetime import datetime
    if (len(value) == 15):
        time_string = value[6:12]
        format_string = u'%y%m%d'
    else:
        time_string = value[6:14]
        format_string = u'%Y%m%d'
    try:
        datetime.strptime(time_string, format_string)
        return True
    except ValueError:
        return False
