def writePlist(dataObject, filepath):
    plistData, error = \
     NSPropertyListSerialization.dataFromPropertyList_format_errorDescription_(
                            dataObject, NSPropertyListXMLFormat_v1_0, None)
    if error:
        error = error.encode('ascii', 'ignore')
        raise NSPropertyListSerializationException(error)
    else:
        if plistData.writeToFile_atomically_(filepath, True):
            return
        else:
            raise NSPropertyListWriteException(
                                "Failed to write plist data to %s" % filepath)
Write 'rootObject' as a plist to filepath.
dataset/ETHPy150Open grahamgilbert/Crypt/Crypt/FoundationPlist.py/writePlist