def validate(cls, cnpj):
        u"""
        Válida o CNPJ.

        >>> CNPJ.validate(58414462000135)
        True
        >>> CNPJ.validate(58414462000136)
        False
        >>> CNPJ.validate('58414462000135')
        True
        >>> CNPJ.validate('58.414.462/0001-35')
        True
        """
        if cnpj is None:
            return False

        digitos_validacao = [6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2]

        cnpj = CNPJ.clean(cnpj)

        def mod11(value):
            value = value % 11
            return 11 - value if value > 1 else 0

        dig1 = mod11(sum([digitos_validacao[i] * int(cnpj[i - 1]) for i in range(1, 13)]))
        dig2 = mod11(sum([digitos_validacao[i] * int(cnpj[i]) for i in range(0, 13)]))

        return cnpj[-2:] == '{0}{1}'.format(dig1, dig2)
def validate ( cls , cnpj ) : if cnpj is None : return False digitos_validacao = [ 6 , 5 , 4 , 3 , 2 , 9 , 8 , 7 , 6 , 5 , 4 , 3 , 2 ] cnpj = CNPJ . clean ( cnpj ) def mod11 ( value ) : value = value % 11 return 11 - value if value > 1 else 0 dig1 = mod11 ( sum ( [ digitos_validacao [ i ] * int ( cnpj [ i - 1 ] ) for i in range ( 1 , 13 ) ] ) ) dig2 = mod11 ( sum ( [ digitos_validacao [ i ] * int ( cnpj [ i ] ) for i in range ( 0 , 13 ) ] ) ) return cnpj [ - 2 : ] == '{0}{1}' . format ( dig1 , dig2 )
u"""
        Válida o CNPJ.

        >>> CNPJ.validate(58414462000135)
        True
        >>> CNPJ.validate(58414462000136)
        False
        >>> CNPJ.validate('58414462000135')
        True
        >>> CNPJ.validate('58.414.462/0001-35')
        True