code: def _choose_update_fn(repo, how, is_annex=False, adjusted=False):
      if adjusted and how != "merge":
          raise RuntimeError(
              "bug: Upstream checks should abort if adjusted is used "
              "with action other than 'merge'"
          )
      elif how in ["merge", "ff-only"]:
          if adjusted and is_annex:
              # For adjusted repos, blindly sync.
              fn = _annex_sync
          elif is_annex:
              fn = _annex_plain_merge
          elif adjusted:
              raise RuntimeError(
                  "bug: Upstream checks should make it impossible for "
                  "adjusted=True, is_annex=False"
              )
          else:
              fn = _plain_merge
      elif how == "reset":
          fn = _reset_hard
      elif how == "checkout":
          fn = _checkout
      else:
          raise ValueError(f"Unrecognized value for `how`: {how}")
      return fn
  
imports: import logging
  from os.path import lexists
  import itertools
  from datalad.interface.base import Interface
  from datalad.interface.base import build_doc, eval_results
  from datalad.interface.results import get_status_dict, YieldDatasets
  from datalad.support.constraints import EnsureBool, EnsureChoice, EnsureStr, EnsureNone
  from datalad.support.annexrepo import AnnexRepo
  from datalad.support.exceptions import CapturedException, CommandError
  from datalad.support.param import Parameter
  from datalad.interface.common_opts import recursion_flag, recursion_limit
  from datalad.distribution.dataset import require_dataset
  from .dataset import EnsureDataset, datasetmethod
label_desc: Use image node_id 4 for calling a global function with example usage: _choose_update_fn(repo, how, is_annex, adjusted) and returns: fn