def _get_repo_root() -> Optional[str]:
    """Returns the root folder of the project."""
    # Get root of this repository. Assume we don't have directories nested deeper than 10 items.
    p = Path(os.getcwd())
    for i in range(10):
        if p is None:
            break
        if Path(p / ".git").exists():
            return str(p)
        # .git is not available in repos cloned via Cloud Build
        # setup.py is always in the library's root, so use that instead
        # https://github.com/googleapis/synthtool/issues/792
        if Path(p / "setup.py").exists():
            return str(p)
        p = p.parent
    raise Exception("Unable to detect repository root.")
Returns the root folder of the project.
samples/snippets/noxfile.py