code: def _test_version_check(host, dspath, store):
      dspath = Path(dspath)
      store = Path(store)
  
      ds = Dataset(dspath).create()
      populate_dataset(ds)
      assert_repo_status(ds.path)
  
      # set up store:
      io = SSHRemoteIO(host) if host else LocalIO()
      if host:
          store_url = "ria+ssh://{host}{path}".format(
              host=host, path=store
          )
      else:
          store_url = "ria+{}".format(store.as_uri())
  
      create_store(io, store, "1")
  
      # TODO: Re-establish test for version 1
      # version 2: dirhash
      create_ds_in_store(io, store, ds.id, "2", "1")
  
      # add special remote
      init_opts = common_init_opts + ["url={}".format(store_url)]
      ds.repo.init_remote("store", options=init_opts)
      ds.push(".", to="store")
  
      # check version files
      remote_ds_tree_version_file = store / "ria-layout-version"
      dsgit_dir, archive_dir, dsobj_dir = get_layout_locations(
          1, store, ds.id
      )
      remote_obj_tree_version_file = dsgit_dir / "ria-layout-version"
  
      assert_true(remote_ds_tree_version_file.exists())
      assert_true(remote_obj_tree_version_file.exists())
  
      with open(str(remote_ds_tree_version_file), "r") as f:
          assert_equal(f.read().strip(), "1")
      with open(str(remote_obj_tree_version_file), "r") as f:
          assert_equal(f.read().strip(), "2")
  
      # Accessing the remote should not yield any output regarding versioning,
      # since it's the "correct" version. Note that "fsck" is an arbitrary choice.
      # We need just something to talk to the special remote.
      with swallow_logs(new_level=logging.INFO) as cml:
          ds.repo.fsck(remote="store", fast=True)
          # TODO: For some reason didn't get cml.assert_logged to assert
          #       "nothing was logged"
          assert not cml.out
  
      # Now fake-change the version
      with open(str(remote_obj_tree_version_file), "w") as f:
          f.write("X\n")
  
      # Now we should see a message about it
      with swallow_logs(new_level=logging.INFO) as cml:
          ds.repo.fsck(remote="store", fast=True)
          cml.assert_logged(
              level="INFO",
              msg="Remote object tree reports version X",
              regex=False,
          )
  
      # reading still works:
      ds.drop(".")
      assert_status("ok", ds.get("."))
  
      # but writing doesn't:
      with open(str(Path(ds.path) / "new_file"), "w") as f:
          f.write("arbitrary addition")
      ds.save(message="Add a new_file")
  
      with assert_raises((CommandError, IncompleteResultsError)):
          ds.push("new_file", to="store")
  
      # However, we can force it by configuration
      ds.config.add(
          "annex.ora-remote.store.force-write", "true", scope="local"
      )
      ds.push("new_file", to="store")
  
imports: import logging
  import stat
  from datalad.api import Dataset, clone, create_sibling_ria
  from datalad.cmd import NoCapture
  from datalad.customremotes.ria_utils import create_ds_in_store, create_store, get_layout_locations
  from datalad.distributed.ora_remote import LocalIO, SSHRemoteIO, _sanitize_key
  from datalad.distributed.tests.ria_utils import common_init_opts, get_all_files, populate_dataset
  from datalad.support.exceptions import CommandError, IncompleteResultsError
  from datalad.tests.utils_pytest import SkipTest, assert_equal, assert_false, assert_in, assert_not_in, assert_raises, assert_repo_status, assert_status, assert_true, has_symlink_capability, known_failure_windows, serve_path_via_http, skip_if_adjusted_branch, skip_if_no_network, skip_if_root, skip_ssh, skip_wo_symlink_capability, slow, swallow_logs, turtle, with_tempfile
  from datalad.utils import Path
label_desc: Use image node_id 13 for calling a global function with example usage: _test_version_check(host, dspath, store) without return types