def when_equal(self, key: Hashable, value: Any, **when_kwargs) -> StateWatcher:
        """
        Block until ``state[key] == value``, and then return a copy of the state.

        .. include:: /api/state/get_when_equality.rst
        """

        def _(snapshot):
            try:
                return snapshot[key] == value
            except KeyError:
                return False

        return self.when(_, **when_kwargs)
Block until ``state[key] == value``, and then return a copy of the state.

        .. include:: /api/state/get_when_equality.rst