code: def _ensure_version(io, base_path, version):
      """Check a store or dataset version and make sure it is declared
  
      Parameters
      ----------
      io: SSHRemoteIO or LocalIO
      base_path: Path
        root path of a store or dataset
      version: str
        target layout version of the store (dataset tree)
      """
      version_file = base_path / "ria-layout-version"
      if io.exists(version_file):
          existing_version = (
              io.read_file(version_file).split("|")[0].strip()
          )
          if existing_version != version.split("|")[0]:
              # We have an already existing location with a conflicting version on
              # record.
              # Note, that a config flag after pipe symbol is fine.
              raise ValueError(
                  "Conflicting version found at target: {}".format(
                      existing_version
                  )
              )
          else:
              # already exists, recorded version fits - nothing to do
              return
      # Note, that the following does create the base-path dir as well, since
      # mkdir has parents=True:
      io.mkdir(base_path)
      io.write_file(version_file, version)
  
file_path: datalad/datalad/customremotes/ria_utils.py
imports: import logging
  from pathlib import Path
label_desc: Use image node_id 3 for calling a global function with example usage: _ensure_version(io, base_path, version) without return types