def find_folder_on_path(path, target='.git', **kwargs):
    """

    Given a path, find the repo root. The root is considered the top-level
    folder containing the '.git' folder. This method will traverse up the
    tree, searching each level.

    If not `.git` folder is found, None is returned. Otherwise the parent
    folder path of the `.git` folder is returned.

    # Parameters

    path:pathlib.Path
        - the path to search for the repo root.

    target:str
        - The name of the folder to search for. The parent of this
          folder is considered the root folder. parent folder to be the
          root folder
        - Default - '.git' - We'll use the .git folder to identify the
          parent folder.

    # Return

    If the 'target'  is found, the parent of 'target'  is
    returned. Otherwise None is returned.

    """

    # construct the search list, we want to search the path and its
    # parents.
    search = [path] + list(path.parents)

    for p in search:

        if p.joinpath(target).exists():
            return p

    return None