code: def check_target_ssh_recursive(
      use_ssh, origin, src_path, target_path
  ):
      _mk_submodule_annex(origin, "test-annex.dat", "whatever")
  
      # prepare src
      source = install(src_path, source=origin, recursive=True)
  
      sub1 = Dataset(opj(src_path, "subm 1"))
      sub2 = Dataset(opj(src_path, "2"))
  
      for flat in False, True:
          target_path_ = target_dir_tpl = target_path + "-" + str(flat)
  
          if flat:
              target_dir_tpl += "/prefix%RELNAME"
              sep = "-"
          else:
              sep = os.path.sep
  
          if use_ssh:
              sshurl = "ssh://datalad-test" + target_path_
          else:
              sshurl = target_path_
  
          remote_name = "remote-" + str(flat)
          with chpwd(source.path):
              assert_create_sshwebserver(
                  name=remote_name,
                  sshurl=sshurl,
                  target_dir=target_dir_tpl,
                  recursive=True,
                  ui=have_webui(),
              )
  
          # raise if git repos were not created
          for suffix in [sep + "subm 1", sep + "2", ""]:
              target_dir = (
                  opj(target_path_, "prefix" if flat else "").rstrip(
                      os.path.sep
                  )
                  + suffix
              )
              # raise if git repos were not created
              GitRepo(target_dir, create=False)
  
              if have_webui():
                  from datalad_deprecated.tests.test_create_sibling_webui import (
                      assert_publish_with_ui,
                  )
  
                  assert_publish_with_ui(
                      target_dir, rootds=not suffix, flat=flat
                  )
  
          for repo in [source.repo, sub1.repo, sub2.repo]:
              assert_not_in("local_target", repo.get_remotes())
  
          # now, push should work:
          push(dataset=source, to=remote_name)
  
          # verify that we can create-sibling which was created later and possibly
          # first published in super-dataset as an empty directory
          sub3_name = "subm 3-%s" % flat
          sub3 = source.create(sub3_name)
          # since is an empty value to force it to consider all changes since we published
          # already
          with chpwd(source.path):
              # as we discussed in gh-1495 we use the last-published state of the base
              # dataset as the indicator for modification detection with since='^'
              # hence we must not publish the base dataset on its own without recursion,
              # if we want to have this mechanism do its job
              # push(to=remote_name)  # no recursion
              out1 = assert_create_sshwebserver(
                  name=remote_name,
                  sshurl=sshurl,
                  target_dir=target_dir_tpl,
                  recursive=True,
                  existing="skip",
                  ui=have_webui(),
                  since="^",
              )
              assert_postupdate_hooks(
                  target_path_, installed=have_webui(), flat=flat
              )
              assert_result_count(
                  out1, 1, status="ok", sibling_name=remote_name
              )
  
              # ensure that nothing is created since since is used.
              # Also cover deprecation for since='' support.  Takes just 60ms or so.
              # TODO: change or remove when removing since='' deprecation support
              out2 = assert_create_sshwebserver(
                  name=remote_name,
                  sshurl=sshurl,
                  target_dir=target_dir_tpl,
                  recursive=True,
                  existing="skip",
                  ui=have_webui(),
                  since="",
              )
              assert_result_count(
                  out2, 1, status="notneeded", sibling_name=remote_name
              )
  
          # so it was created on remote correctly and wasn't just skipped
          assert Dataset(
              _path_(
                  target_path_, ("prefix-" if flat else "") + sub3_name
              )
          ).is_installed()
          push(
              dataset=source, to=remote_name, recursive=True, since="^"
          )
  
imports: import logging
  import os
  import stat
  import sys
  from os import chmod
  from os.path import basename, exists
  from os.path import join
  import pytest
  from datalad.api import create_sibling, install, push
  from datalad.cmd import StdOutErrCapture
  from datalad.cmd import WitlessRunner
  from datalad.distribution.create_sibling import _RunnerAdapter
  from datalad.support.annexrepo import AnnexRepo
  from datalad.support.exceptions import CommandError, InsufficientArgumentsError
  from datalad.support.gitrepo import GitRepo
  from datalad.support.network import urlquote
  from datalad.tests.utils_testdatasets import _mk_submodule_annex
  from datalad.tests.utils_pytest import DEFAULT_BRANCH, DEFAULT_REMOTE, SkipTest, assert_dict_equal, assert_false, assert_in, assert_in_results, assert_no_errors_logged, assert_not_equal, assert_not_in, assert_raises, assert_repo_status, assert_result_count, assert_status, create_tree, eq_, get_mtimes_and_digests, get_ssh_port, known_failure_windows, ok_, ok_endswith, ok_file_has_content, ok_file_under_git, skip_if_on_windows, skip_if_root, skip_ssh, slow, swallow_logs, with_tempfile, with_testsui
  from datalad.utils import Path, _path_, chpwd, on_windows
  from ..dataset import Dataset
label_desc: Use image node_id 5 for calling a global function with example usage: check_target_ssh_recursive(use_ssh, origin, src_path, target_path) without return types