def nest_paths(paths):
    """
    Given a list of paths, convert them into a nested structure that will match
    the pages config.
    """
    nested = []

    for path in paths:
        parts = PurePath(path).parent.parts

        branch = nested
        for part in parts:
            part = dirname_to_title(part)
            branch = find_or_create_node(branch, part)

        branch.append(path)

    return nested

    Given a list of paths, convert them into a nested structure that will match
    the pages config.
    
mkdocs/utils/__init__.py