docs: def state_engine_verify(trusted_consensus_hash, consensus_block_height, consensus_impl, untrusted_working_dir, new_state_engine, start_block=None, expected_snapshots={}):
      """
      Verify that a database is consistent with a
      known-good consensus hash.
  
      This algorithm works by creating a new database,
      parsing the untrusted database, and feeding the untrusted
      operations into the new database block-by-block.  If we
      derive the same consensus hash, then we can trust the
      database.
  
      Return True if consistent with the given consensus hash at the given consensus block height
      Return False if not
      """
      
      assert hasattr(consensus_impl, 'get_initial_snapshots')
  
      final_consensus_hash = state_engine_replay(consensus_impl, untrusted_working_dir, new_state_engine, consensus_block_height, \
                                                 start_block=start_block, initial_snapshots=consensus_impl.get_initial_snapshots(), expected_snapshots=expected_snapshots)
  
      # did we reach the consensus hash we expected?
      if final_consensus_hash is not None and final_consensus_hash == trusted_consensus_hash:
          return True
  
      else:
          log.error("Unverifiable database state stored in '{}': {} != {}".format(untrusted_working_dir, final_consensus_hash, trusted_consensus_hash))
          return False