docs: def levels_to_accepting_states(self) -> dict:
          """Return a dict from states to level, i.e. the number of steps to reach any accepting state.
          level = -1 if the state cannot reach any accepting state"""
  
          res = {accepting_state: 0 for accepting_state in self._accepting_states}
          level = 0
  
          # least fixpoint
          z_current, z_next = set(), set()
          z_next = set(self._accepting_states)
  
          while z_current != z_next:
              level += 1
              z_current = z_next
              z_next = copy(z_current)
              for state in self._transition_function:
                  for action in self._transition_function[state]:
                      if state in z_current:
                          continue
                      next_state = self._transition_function[state][action]
                      if next_state in z_current:
                          z_next.add(state)
                          res[state] = level
                          break
  
          z_current = z_next
          for failure_state in filter(lambda x: x not in z_current, self._states):
              res[failure_state] = -1
  
          return res