code: def _get_corresponding_remote_state(repo, to):
      since = None
      # for managed branches we cannot assume a matching one at the remote end
      # instead we target the corresponding branch
      active_branch = (
          repo.get_corresponding_branch() or repo.get_active_branch()
      )
  
      if to:
          # XXX here we assume one to one mapping of names from local branches
          # to the remote
          since = "%s/%s" % (to, active_branch)
      else:
          # take tracking remote for the active branch
          tracked_remote, tracked_refspec = repo.get_tracking_branch()
          if tracked_remote:
              if tracked_refspec.startswith("refs/heads/"):
                  tracked_refspec = tracked_refspec[
                      len("refs/heads/") :
                  ]
              # to = tracked_remote
              since = "%s/%s" % (tracked_remote, tracked_refspec)
      return since
  
imports: from itertools import chain
  import logging
  import re
  from datalad.interface.base import Interface, build_doc, eval_results
  from datalad.interface.common_opts import jobs_opt, recursion_limit, recursion_flag
  from datalad.interface.utils import render_action_summary
  from datalad.interface.results import annexjson2result
  from datalad.log import log_progress
  from datalad.support.annexrepo import AnnexRepo
  from datalad.support.gitrepo import GitRepo
  from datalad.support.param import Parameter
  from datalad.support.constraints import EnsureStr, EnsureNone, EnsureChoice
  from datalad.support.exceptions import CommandError
  from datalad.utils import Path, ensure_list, todo_interface_for_extensions
  from datalad.distribution.dataset import Dataset, EnsureDataset, datasetmethod, require_dataset, resolve_path
  from datalad.core.local.diff import diff_dataset
label_desc: Use image node_id 7 for calling a global function with example usage: _get_corresponding_remote_state(repo, to) and returns: since