from functools import reduce


def mac_aton(s):
    """Convert a Mac address to an integer."""
    try:
        mac = list(map(lambda x: int(x, 16), s.split(':')))
        mac = reduce(lambda a,b: a+b, [mac[i] << (5-i)*8 for i in range(6)])
    except (ValueError, IndexError):
        raise ValueError('illegal Mac: {0}'.format(s))
    return mac