Updates hunt output plugin state for a given output plugin.

def UpdateHuntOutputPluginState(self, hunt_id, state_index, update_fn):
    """Updates hunt output plugin state for a given output plugin."""

    if hunt_id not in self.hunts:
      raise db.UnknownHuntError(hunt_id)

    try:
      state = rdf_flow_runner.OutputPluginState.FromSerializedString(
          self.hunt_output_plugins_states[hunt_id][state_index])
    except KeyError:
      raise db.UnknownHuntOutputPluginError(hunt_id, state_index)

    state.plugin_state = update_fn(state.plugin_state)

    self.hunt_output_plugins_states[hunt_id][
        state_index] = state.SerializeToString()

    return state.plugin_state