code: def _get_git_commit(path):
      """
      Function to get the git commit from a path.
      """
      if git is None:
          warnings.warn(
              "Failed to import Git (the Git executable is probably not on your PATH), so Git SHA is not available."
          )
          return None
  
      try:
          repo = git.Repo(path, search_parent_directories=True)
          commit = repo.head.commit.hexsha
          return commit
      except (git.InvalidGitRepositoryError, git.NoSuchPathError) as e:
          warnings.warn(
              f"Failed to grab the git repository so Git SHA is not available. Error: {e}"
          )
          return None
  
imports: import os
  import warnings
  from typing import Any, Dict, Mapping, Optional, Sequence, Union
  from poutyne.framework.callbacks.logger import Logger
label_desc: Use image node_id 1 for calling a global function with example usage: _get_git_commit(path) and returns: None, commit, None