code: def _compute_merkle_root(self, required_state_root):
          
  
          state_hash = None
          if self._previous_valid_batch_c_id is not None:
              publishing_or_genesis = self._always_persist or \
                  required_state_root is None
              state_hash = self._squash(
                  state_root=self._previous_state_hash,
                  context_ids=[self._previous_valid_batch_c_id],
                  persist=self._always_persist, clean_up=publishing_or_genesis)
              if self._always_persist is True:
                  return state_hash
              if state_hash == required_state_root:
                  self._squash(state_root=self._previous_state_hash,
                               context_ids=[self._previous_valid_batch_c_id],
                               persist=True, clean_up=True)
          return state_hash
docs: Computes the merkle root of the state changes in the context
          corresponding with _last_valid_batch_c_id as applied to
          _previous_state_hash.
  
          Args:
              required_state_root (str): The merkle root that these txns
                  should equal.
  
          Returns:
              state_hash (str): The merkle root calculated from the previous
                  state hash and the state changes from the context_id