def METHOD_NAME(config_path: str, output_directory: str = "./ref/", package_root: str = None) -> None:
    multiapi_found_apiversion = {}
    # we are handed a directory that looks like <path-to-repo>/sdk/containerservice/azure-mgmt-containerservice/
    project_pattern = os.path.basename(package_root).replace("-", ".")
    rst_path_template = os.path.join(output_directory, "{}.rst")
    rst_namespace_template = os.path.join(output_directory, "{}.{}.rst")
    config = get_updated_config(config_path, package_root)
    package_list_path = []
    namespaces = [n for pack in config.values() for n in pack.get("namespaces", {})]
    for namespace in namespaces:
        if project_pattern and not any(namespace.startswith(p) for p in project_pattern):
            _LOGGER.info("Skip project %s", namespace)
            continue
        _LOGGER.info("Working on %s", namespace)
        rst_path = rst_path_template.format(namespace)
        with Path(rst_path).open("w") as rst_file:
            rst_file.write(PACKAGE_TEMPLATE.format(title=make_title(namespace + " package"), namespace=namespace))
        for module in ["operations", "models"]:
            with Path(rst_namespace_template.format(namespace, module)).open("w") as rst_file:
                rst_file.write(
                    SUBMODULE_TEMPLATE.format(
                        title=make_title(namespace + "." + module + " module"), namespace=namespace, submodule=module
                    )
                )
        for multiapi_namespace in MULTIAPI_VERSION_NAMESPACE:
            length = len(multiapi_namespace.split("."))
            if namespace.split(".")[0:length] == multiapi_namespace.split(".")[0:length]:
                _LOGGER.info("MultiAPI namespace on %s", multiapi_namespace)
                api_package = namespace.split(multiapi_namespace + ".")[1]
                multiapi_found_apiversion.setdefault(multiapi_namespace, []).append(api_package)
                break
        else:
            package_list_path.append(rst_path)
    for multiapi_namespace, apilist in multiapi_found_apiversion.items():
        apilist.sort()
        apilist.reverse()
        rst_path = rst_path_template.format(multiapi_namespace)
        with Path(rst_path).open("w") as rst_file:
            rst_file.write(
                MULTIAPI_VERSION_PACKAGE_TEMPLATE.format(
                    title=make_title(multiapi_namespace + " package"), namespace=multiapi_namespace
                )
            )
            for version in apilist:
                rst_file.write("   {namespace}.{version}\n".format(namespace=multiapi_namespace, version=version))
        package_list_path.append(rst_path)
    # now handle the packages from data plane that we want to be present properly sorted in the list of packages
    for package in config.keys():
        if "manually_generated" in config[package] and config[package]["manually_generated"] == True:
            package_list_path.append(rst_path_template.format(package.replace("-", ".")))
    package_list_path.sort()
    with Path(GENERATED_PACKAGES_LIST_FILE).open("w") as generate_file_list_fd:
        lines_to_write = "\n".join(["  " + package for package in package_list_path])
        generate_file_list_fd.write(RST_AUTODOC_TOCTREE.format(generated_packages=lines_to_write))