(toc, ref_id, objtype)
return None
Find the actual TOC node for a ref_id.

    Depends on the object type:
    * Section - First section (refuri) or 2nd+ level section (anchorname)
    * Desc - Just use the anchor name
Find the actual TOC node for a ref_id.
Find the actual TOC node for a ref_id .
def _find_toc_node(toc, ref_id, objtype):
    """
    Find the actual TOC node for a ref_id.

    Depends on the object type:
    * Section - First section (refuri) or 2nd+ level section (anchorname)
    * Desc - Just use the anchor name
    """
    for check_node in toc.traverse(nodes.reference):
        if objtype == nodes.section and (
            check_node.attributes["refuri"] == ref_id
            or check_node.attributes["anchorname"] == "#" + ref_id
        ):
            return check_node
        if (
            objtype == addnodes.desc
            and check_node.attributes["anchorname"] == "#" + ref_id
        ):
            return check_node
    return None
def _find_toc_node ( toc , ref_id , objtype ) : for check_node in toc . traverse ( nodes . reference ) : if objtype == nodes . section and ( check_node . attributes [ "refuri" ] == ref_id or check_node . attributes [ "anchorname" ] == "#" + ref_id ) : return check_node if ( objtype == addnodes . desc and check_node . attributes [ "anchorname" ] == "#" + ref_id ) : return check_node return None