code: def checkout_moses_tokenizer(workspace_dir: str):
      
      # Prerequisites
      check_git()
      check_perl()
      # Check cache
      dest = os.path.join(workspace_dir, DIR_THIRD_PARTY, MOSES_DEST)
      if confirm_checkout(dest, MOSES_COMMIT):
          logging.info("Usable: %s", dest)
          return
      # Need to (re-)checkout
      if os.path.exists(dest):
          shutil.rmtree(dest)
      logging.info("Checkout: %s -> %s", MOSES_REPO, dest)
      os.makedirs(dest)
      log_fname = os.path.join(workspace_dir, DIR_LOGS, "checkout.{}.{}.log".format(MOSES_DEST, os.getpid()))
      with open(log_fname, "wb") as log:
          logging.info("Log: %s", log_fname)
          subprocess.call(["git", "init"], cwd=dest, stdout=log, stderr=log)
          subprocess.call(["git", "remote", "add", "origin", MOSES_REPO], cwd=dest, stdout=log, stderr=log)
          subprocess.call(["git", "config", "core.sparsecheckout", "true"], cwd=dest, stdout=log, stderr=log)
          with open(os.path.join(dest, ".git", "info", "sparse-checkout"), "w") as out:
              for path in MOSES_SPARSE_CHECKOUT:
                  print(path, file=out)
          subprocess.call(["git", "pull", "origin", "master"], cwd=dest, stdout=log, stderr=log)
          subprocess.call(["git", "checkout", MOSES_COMMIT], cwd=dest, stdout=log, stderr=log)
docs: Checkout Moses tokenizer (sparse checkout of Moses).
  
      :param workspace_dir: Workspace directory.