code: def is_git_directory_clean(path_to_repo: Path,
                             search_parent_dirs: bool = True,
                             check_untracked: bool = False) -> None:
      
      repo = Repo(str(path_to_repo), search_parent_directories=search_parent_dirs)
      logger.debug("is_git_directory_clean check for repo in path={} from "\
                    "cwd={} with search_parent_directories={}".format(
                          path_to_repo, os.getcwd(), search_parent_dirs))
  
      # If there are changes to already tracked files
      if repo.is_dirty():
          raise DirtyRepoException("Changes to the index or working tree."
                                   "Commit them first .")
      if check_untracked:
          if repo.untracked_files:
              raise DirtyRepoException("Untracked files. Commit them first.")
docs: Check that the git working directory is in a clean state
      and raise exceptions if not.
      :path_to_repo: The path of the git repo