@classmethod    
    def isDate(cls, value, country='nl'):
        monthdays = [0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
        try:
            split = re.findall(cls.DATEPATTERN, value)    
        except TypeError:
            return False
            
        if not split:
            #print '[%s] Date has wrong format' % value
            return False

        d1 = int(split[0][0])
        d2 = int(split[0][1])
        d3 = int(split[0][2])
        if d1 >= 1000:
            # d1 is year
            if country == 'nl':        # d2 is month
                m = d2
                d = d3
            else:
                m = d3
                d = d2
        elif d3 >= 1000:
            # d3 is year
            if country == 'nl':        # d2 is month
                m = d2
                d = d1
            else:
                m = d1
                d = d2
        else:    # We don't support years < 1000
            #print '[%s] Year is out of range' % value
            return False
            
        if not (1 <= m <= 12):
            #print '[%s] Month is out of range' % value
            return False
            
        if not (1 <= d <= monthdays[m]):
            #print '[%s] Day is out of range for this month' % value
            return False

        return True
See PEP 302 extensions.
dataset/ETHPy150Open petrvanblokland/Xierpa3/xierpa3/toolbox/parsers/validator.py/Validator.isDate--crossover with--dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/tools/dev_appserver_import_hook.py/HardenedModulesHook.is_package