import re


def verify_mod10(ccnum):
    """
    Check a credit card number for validity using the mod10 algorithm.
    """
    ccnum = re.sub(r'[^0-9]', '', ccnum)
    double, sum = 0, 0
    for i in range(len(ccnum) - 1, -1, -1):
            for c in str((double + 1) * int(ccnum[i])): sum = sum + int(c)
            double = (double + 1) % 2
    return ((sum % 10) == 0)