code: def fetch_user_repo(user_script):
      """Fetch the GIT repo and its root path given user's script."""
      dir_path = os.path.dirname(os.path.abspath(user_script))
      try:
          git_repo = git.Repo(dir_path, search_parent_directories=True)
      except git.exc.InvalidGitRepositoryError:
          git_repo = None
          logging.warning(
              "Script %s is not in a git repository. Code modification "
              "won't be detected.",
              os.path.abspath(user_script),
          )
      return git_repo
  
imports: import copy
  import getpass
  import hashlib
  import logging
  import os
  import git
  import yaml
  from numpy import inf
  import orion
  import orion.core
  from orion.core.io.orion_cmdline_parser import OrionCmdlineParser
  from orion.core.utils.flatten import unflatten
label_desc: Use image node_id 9 for calling a global function with example usage: fetch_user_repo(user_script) and returns: git_repo