code: def writePlistToString(rootObject):
      '''Return 'rootObject' as a plist-formatted string.'''
      plistData, error = (
          NSPropertyListSerialization.
          dataFromPropertyList_format_errorDescription_(
              rootObject, NSPropertyListXMLFormat_v1_0, None))
      if plistData is None:
          if error:
              error = error.encode('ascii', 'ignore')
          else:
              error = "Unknown error"
          raise NSPropertyListSerializationException(error)
      else:
          return str(plistDataf writePlistToString(rootObject):
      '''Return 'rootObject' as a plist-formatted string.'''
      plistData, error = (
          NSPropertyListSerialization.
          dataFromPropertyList_format_errorDescription_(
              rootObject, NSPropertyListXMLFormat_v1_0, None))
      if plistData is None:
          if error:
              error = error.encode('ascii', 'ignore')
          else:
              error = "Unknown error"
          raise NSPropertyListSerializationException(error)
      else:
          return str(plistData)
docs: Return 'rootObject' as a plist-formatted string.