def isValidMac(mac):
    """Checks whether MAC address is valid."""
    assert mac is not None
    bytes = mac.split(":")
    if len(bytes) != 6:
        return False
    for byte in bytes:
        val = int(byte, 16)
        if val < 0 or val > 255:
            return False
    return True