def GetMacSerial():
    """Returns the serial number for the Mac
        """
    global SERIAL
    if SERIAL is None:
        platformExpert = iokit.IOServiceGetMatchingService(kIOMasterPortDefault,
                                                           iokit.IOServiceMatching("IOPlatformExpertDevice"))
        if platformExpert:
            key = cf.CFStringCreateWithCString(kCFAllocatorDefault, kIOPlatformSerialNumberKey, kCFStringEncodingMacRoman)
            serialNumberAsCFString = \
                iokit.IORegistryEntryCreateCFProperty(platformExpert,
                                                      key,
                                                      kCFAllocatorDefault, 0);
            if serialNumberAsCFString:
                SERIAL = cf.CFStringGetCStringPtr(serialNumberAsCFString, 0)

            iokit.IOObjectRelease(platformExpert)
    # The slashes VMware puts in sometimes stuffs up the app
    SERIAL = SERIAL.replace("/", "")
    return SERIAL
dataset/ETHPy150Open grahamgilbert/Crypt/Crypt/FVUtils.py/GetMacSerial/original