code: def factory(data):
          
          if data['name'] is "DeviceStateChangedEvent":
              return DeviceStateChangedEvent(data)
          elif data['name'] is "ExecutionStateChangedEvent":
              return ExecutionStateChangedEvent(data)
          elif data['name'] is "CommandExecutionStateChangedEvent":
              return CommandExecutionStateChangedEvent(data)
          else:
              raise ValueError("Unknown event '" + data['name'] + "' occurred.")
docs: Tahoma Event factory.