code: def SCM(root_dir, *, search_parent_directories=True, no_scm=False):
      """Returns SCM instance that corresponds to a repo at the specified
      path.
  
      Args:
          root_dir (str): path to a root directory of the repo.
          search_parent_directories (bool): whether to look for repo root in
          parent directories.
          no_scm (bool): return NoSCM if True.
  
      Returns:
          dvc.scm.base.Base: SCM instance.
      """
      with map_scm_exception():
          if no_scm:
              return NoSCM(
                  root_dir, _raise_not_implemented_as=NoSCMError
              )
          return Git(
              root_dir,
              search_parent_directories=search_parent_directories,
          )
  
imports: import os
  from contextlib import contextmanager
  from functools import partial
  from typing import TYPE_CHECKING, Iterator, List, Literal, Mapping, Optional, Union, overload
  from funcy import group_by
  from scmrepo.base import Base
  from scmrepo.git import Git
  from scmrepo.noscm import NoSCM
  from dvc.exceptions import DvcException
  from dvc.progress import Tqdm
label_desc: Use image node_id 5 for calling a global function with example usage: SCM(root_dir) and returns: Git, NoSCM