docs: def add_new_state(state_machine_m, state_type):
      """Triggered when shortcut keys for adding a new state are pressed, or Menu Bar "Edit, Add State" is clicked.
  
      Adds a new state only if the parent state (selected state) is a container state, and if the graphical editor or
      the state machine tree are in focus.
      """
      assert isinstance(state_machine_m, StateMachineModel)
  
      if state_type not in list(StateType):
          state_type = StateType.EXECUTION
  
      if len(state_machine_m.selection.states) != 1:
          logger.warning("Please select exactly one desired parent state, before adding a new state")
          return
      state_m = state_machine_m.selection.get_selected_state()
      if is_selection_inside_of_library_state(selected_elements=[state_m]):
          logger.warning("Add new state is not performed because selected target state is inside of a library state.")
          return
  
      if isinstance(state_m, StateModel):
          return gui_helper_state.add_state(state_m, state_type)
      else:
          logger.warning("Add new state is not performed because target state indication has to be a {1} not {0}"
                      "".format(state_m.__class__.__name__, StateModel.__name__))
  
      # TODO this code can not be reached -> recover again? -> e.g. feature select transition add's state to parent
      if isinstance(state_m, (TransitionModel, DataFlowModel)) or \
              isinstance(state_m, (DataPortModel, OutcomeModel)) and isinstance(state_m.parent, ContainerStateModel):
          return gui_helper_state.add_state(state_m.parent, state_type)