'Set the state, and verify that the hash of the state is correct.
:param state: The new state.
:param verify_hash: The expected generation hash of the new state.
:raises: ValueError if the new state does not have the specified hash.'

def _set_state(self, state, verify_hash):

    candidate_hash = make_generation_hash(state)
    if (candidate_hash != verify_hash):
        raise ValueError(('Bad    hash    value    %s    is    not    %s' % (candidate_hash, verify_hash)))
    self._current_state = state
    self._current_state_generation = candidate_hash
