code: def _setup_annex_repo(
      path, initopts=None, fake_dates=False, description=None
  ):
      """Create and configure a repository at `path`
  
      This includes a default setup of annex.largefiles.
  
      Parameters
      ----------
      path: str or Path
        Path of the repository
      initopts: dict, optional
        Git options to be passed to the AnnexRepo constructor
      fake_dates: bool, optional
        Passed to the AnnexRepo constructor
      description: str, optional
        Passed to the AnnexRepo constructor
  
      Returns
      -------
      AnnexRepo, dict
        Created repository and records for any repo component that needs to be
        passed to git-add as a result of the setup procedure.
      """
      # always come with annex when created from scratch
      tbrepo = AnnexRepo(
          path,
          create=True,
          create_sanity_checks=False,
          # do not set backend here, to avoid a dedicated commit
          backend=None,
          # None causes version to be taken from config
          version=None,
          description=description,
          git_opts=initopts,
          fake_dates=fake_dates,
      )
      # set the annex backend in .gitattributes as a staged change
      tbrepo.set_default_backend(
          cfg.obtain("datalad.repo.backend"),
          persistent=True,
          commit=False,
      )
      add_to_git = {
          tbrepo.pathobj
          / ".gitattributes": {
              "type": "file",
              "state": "added",
          }
      }
      # make sure that v6 annex repos never commit content under .datalad
      attrs_cfg = (("config", "annex.largefiles", "nothing"),)
      attrs = tbrepo.get_gitattributes(
          [op.join(".datalad", i[0]) for i in attrs_cfg]
      )
      set_attrs = []
      for p, k, v in attrs_cfg:
          if (
              not attrs.get(op.join(".datalad", p), {}).get(k, None)
              == v
          ):
              set_attrs.append((p, {k: v}))
      if set_attrs:
          tbrepo.set_gitattributes(
              set_attrs, attrfile=op.join(".datalad", ".gitattributes")
          )
  
      # prevent git annex from ever annexing .git* stuff (gh-1597)
      attrs = tbrepo.get_gitattributes(".git")
      if (
          not attrs.get(".git", {}).get("annex.largefiles", None)
          == "nothing"
      ):
          tbrepo.set_gitattributes(
              [("**/.git*", {"annex.largefiles": "nothing"})]
          )
          # must use the repo.pathobj as this will have resolved symlinks
          add_to_git[tbrepo.pathobj / ".gitattributes"] = {
              "type": "file",
              "state": "untracked",
          }
      return tbrepo, add_to_git
  
imports: import os
  import logging
  import random
  import uuid
  import warnings
  from argparse import REMAINDER
  from os import listdir
  import os.path
  from datalad import cfg
  from datalad import _seed
  from datalad.interface.base import Interface
  from datalad.interface.base import build_doc, eval_results
  from datalad.interface.common_opts import location_description
  from datalad.support.constraints import EnsureStr, EnsureNone, EnsureKeyChoice
  from datalad.support.param import Parameter
  from datalad.utils import getpwd, ensure_list, get_dataset_root, Path
  from datalad.distribution.dataset import Dataset, datasetmethod, EnsureDataset, resolve_path, path_under_rev_dataset, require_dataset
  from datalad.support.gitrepo import GitRepo
  from datalad.support.annexrepo import AnnexRepo
label_desc: Use image node_id 2 for calling a global function with example usage: _setup_annex_repo(path, initopts, fake_dates, description) and returns: tbrepo,  add_to_git