def METHOD_NAME(self, pagename, templatename, ctx, event_arg):
    from sphinx.environment.adapters.toctree import TocTree
    def get_nav_object(**kwds):
        toctree = TocTree(self.env).get_toctree_for(pagename, self, collapse=True, **kwds)
        nav = []
        for child in toctree.children[0].children:
            child_nav = convert_docutils_node(child, only_pages=True)
            nav.append(child_nav)
        return nav
    def get_page_toc_object():
        self_toc = TocTree(self.env).get_toc_for(pagename, self)
        try:
            nav = convert_docutils_node(self_toc.children[0])
            return nav
        except Exception:
            return {}
    ctx["get_nav_object"] = get_nav_object
    ctx["get_page_toc_object"] = get_page_toc_object
    return None