@staticmethod
    def calculate_last_digits(cnpj):
        """
        Method to calculate the last two cnpj's digits to make it a valid cnpj
        :param cnpj: a base cnpj without the last two digits containing 12 characters
        :return:
        """

         # verifying the length of the cnpj
        if len(cnpj) != 12:
            raise Exception('It should have 12 characters')

        # defining some variables
        lista_validacao_um = [5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2]
        lista_validacao_dois = [6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2]


        # calculating the first digit
        soma = 0
        id = 0
        for numero in cnpj:

            # to do not raise indexerrors
            try:
                lista_validacao_um[id]
            except:
                break

            soma += int(numero) * int(lista_validacao_um[id])
            id += 1

        soma %= 11
        if soma < 2:
            digito_um = 0
        else:
            digito_um = 11 - soma

        digito_um = str(digito_um)  # converting to string, for later comparison

        # calculating the second digit
        # suming the two lists
        soma = 0
        id = 0
        cnpj += digito_um

        # suming the two lists
        for numero in cnpj:

            # to do not raise indexerrors
            try:
                lista_validacao_dois[id]
            except:
                break

            soma += int(numero) * int(lista_validacao_dois[id])
            id += 1

        # defining the digit
        soma = soma % 11
        if soma < 2:
            digito_dois = 0
        else:
            digito_dois = 11 - soma

        digito_dois = str(digito_dois)

        return [digito_um, digito_dois]
dataset/ETHPy150Open nfscan/ocr-process-service/validation/cnpj.py/Cnpj.calculate_last_digits/original