def transition_allowed(self, initial_state, target_state):
        # type: (str, str) -> bool
        """Check if a transition between two states is allowed"""
        assert initial_state in self._allowed, \
            "%s is not in %s" % (initial_state, list(self._allowed))
        return target_state in self._allowed[initial_state]