code: def _wait(jid):
      '''
      Wait for all previously started state jobs to finish running
      '''
      if jid is None:
          jid = salt.utils.jid.gen_jid(__opts__)
      states = _prior_running_states(jid)
      while states:
          time.sleep(1)
          states = _prior_running_states(jidf _wait(jid):
      '''
      Wait for all previously started state jobs to finish running
      '''
      if jid is None:
          jid = salt.utils.jid.gen_jid(__opts__)
      states = _prior_running_states(jid)
      while states:
          time.sleep(1)
          states = _prior_running_states(jid)
docs: Wait for all previously started state jobs to finish running