def setState(self, state):
    if isinstance(state, int):
        for plugin in self:
            plugin.setState(state)
            self._stateData[plugin.getName()] = plugin.getState()
    else:
        self._stateData = state
        for plugin in self:
            pluginState = self._stateData.get(plugin.getName())
            if pluginState:
                plugin.setState(pluginState)
def setState(self, state):
    if isinstance(state, int):
        for plugin in self:
            plugin.setState(state)
            self._stateData[plugin.getName()] = plugin.getState()
    else:
        self._stateData = state
        for plugin in self:
            pluginState = self._stateData.get(plugin.getName())
            if pluginState:
                plugin.setState(pluginState)