from typing import Protocol class StateMachine(Protocol): def equivalent_to(self, other: "StateMachine") -> bool: raise NotImplementedError def can_transition_from(self, old: "StateMachine") -> bool: raise NotImplementedError def can_transition_to(self, new: "StateMachine") -> bool: raise NotImplementedError