code: def get_git_root(path):
      """
      Args:
          path: (str) Path a to a directory/file that is located inside the repo
      Returns:
          path to the root folder for git repo
      """
      import git
  
      try:
          git_repo = git.Repo(path, search_parent_directories=True)
          return git_repo.git.rev_parse("--show-toplevel")
      except git.exc.NoSuchPathError:
          tail, _ = os.path.split(path)
          return get_git_root_parent_directory(tail, path)
  
imports: import os
  import re
  from snakemake.exceptions import WorkflowError
label_desc: Use image node_id 2 for calling a global function with example usage: get_git_root(path) and returns: git_repo, get_git_root_parent_directory