docs: def _wait_if_required(self, container_state, next_child_state_to_execute, woke_up_from_pause_or_step_mode):
          """ Calls a blocking wait for the calling thread, depending on the execution mode.
  
          :param container_state: the current hierarhcy state to handle the execution mode for
          :param next_child_state_to_execute: the next child state for :param container_state to be executed
          :param woke_up_from_pause_or_step_mode: a flag to check if the execution just woke up from paused- or step-mode
          """
          wait = True
          # if there is a state in self.run_to_states then RAFCON was commanded
          #    a) a step_over
          #    b) a step_out
          #    c) a run_until
          for state_path in copy.deepcopy(self.run_to_states):
              next_child_state_path = None
              # can be None in case of no transition given
              if next_child_state_to_execute:
                  next_child_state_path = next_child_state_to_execute.get_path()
              if state_path == container_state.get_path():
                  # the execution did a whole step_over inside hierarchy state "state" (case a) )
                  # or a whole step_out into the hierarchy state "state" (case b) )
                  # thus we delete its state path from self.run_to_states
                  # and wait for another step (of maybe different kind)
                  wait = True
                  self.run_to_states.remove(state_path)
                  break
              elif state_path == next_child_state_path:
                  # this is the case that execution has reached a specific state explicitly marked via
                  # run_to_selected_state() (case c) )
                  # if this is the case run_to_selected_state() is finished and the execution
                  # has to wait for new execution commands
                  wait = True
                  self.run_to_states.remove(state_path)
                  break
              # don't wait if its just a normal step
              else:
                  wait = False
                  # do not break here, the state_path may be of another state machine branch
                  # break
          # don't wait if the the execution just woke up from step mode or pause
          if wait and not woke_up_from_pause_or_step_mode:
              logger.debug("Stepping mode: waiting for next step!")
              try:
                  self._status.execution_condition_variable.acquire()
                  self.synchronization_counter += 1
                  logger.verbose("Increase synchronization_counter: " + str(self.synchronization_counter))
                  self._status.execution_condition_variable.wait()
              finally:
                  self._status.execution_condition_variable.release()
              # if the status was set to PAUSED or STEP_MODE don't wake up!
              self._wait_while_in_pause_or_in_step_mode()
              # container_state was notified => thus, a new user command was issued, which has to be handled!
              container_state.execution_history.new_execution_command_handled = False