'Create a complete structure for an apple event'

def newevent(self, code, subcode, parameters={}, attributes={}):

    event = AE.AECreateAppleEvent(code, subcode, self.target, AppleEvents.kAutoGenerateReturnID, AppleEvents.kAnyTransactionID)
    packevent(event, parameters, attributes)
    return event
