def add_state_hook(self, state, hook):
        try:
            hooks = self._state_hooks[state]
            assert hook not in hooks
            hooks.append(hook)
        except __HOLE__:
            self._state_hooks[state] = [hook]
        if self._state == state:
            hook(state)
dataset/ETHPy150Open coreemu/core/daemon/core/session.py/Session.add_state_hook