(aPropertyList, format='xml')
return data
Serialize a property list to an NSData object.  Format is one of the
    following strings:

    xml (default):
        NSPropertyListXMLFormat_v1_0, the XML representation

    binary:
        NSPropertyListBinaryFormat_v1_0, the efficient binary representation

    ascii:
        NSPropertyListOpenStepFormat, the old-style ASCII property list

    It is expected that this property list is comprised of Objective-C
    objects.  In most cases Python data structures will work, but
    decimal.Decimal and datetime.datetime objects are not transparently
    bridged so it will fail in that case.  If you expect to have these
    objects in your property list, then use propertyListFromPythonCollection
    before serializing it.
Serialize a property list to an NSData object.  Format is one of the
    following strings:
Serialize a property list to an NSData object . Format is one of the following strings :
def serializePropertyList(aPropertyList, format='xml'):
    """
    Serialize a property list to an NSData object.  Format is one of the
    following strings:

    xml (default):
        NSPropertyListXMLFormat_v1_0, the XML representation

    binary:
        NSPropertyListBinaryFormat_v1_0, the efficient binary representation

    ascii:
        NSPropertyListOpenStepFormat, the old-style ASCII property list

    It is expected that this property list is comprised of Objective-C
    objects.  In most cases Python data structures will work, but
    decimal.Decimal and datetime.datetime objects are not transparently
    bridged so it will fail in that case.  If you expect to have these
    objects in your property list, then use propertyListFromPythonCollection
    before serializing it.
    """
    try:
        formatOption = FORMATS[format]
    except KeyError:
        raise ValueError("Invalid format: %s" % (format,))
    data, err = Foundation.NSPropertyListSerialization.dataFromPropertyList_format_errorDescription_(aPropertyList, formatOption, None)
    if err is not None:
        # braindead API!
        errStr = err.encode('utf-8')
        err.release()
        raise ValueError(errStr)
    return data
def serializePropertyList ( aPropertyList , format = 'xml' ) : try : formatOption = FORMATS [ format ] except KeyError : raise ValueError ( "Invalid format: %s" % ( format , ) ) data , err = Foundation . NSPropertyListSerialization . dataFromPropertyList_format_errorDescription_ ( aPropertyList , formatOption , None ) if err is not None : # braindead API! errStr = err . encode ( 'utf-8' ) err . release ( ) raise ValueError ( errStr ) return data