def is_luhn_valid(self, cc):
        num = [int(x) for x in str(cc)]
        return sum(num[::-2] + [sum(divmod(d * 2, 10)) for d in num[-2::-2]]) % 10 == 0
Method to validate Luhn algorithm based on:
dataset/ETHPy150Open adlibre/Adlibre-DMS/adlibre_dms/apps/core/models.py/DocumentTypeRule.is_luhn_valid