code: def get_node_depth(node: Node) -> int:
      i = 0
      cur_node = node
      while cur_node.parent != node.document:
          cur_node = cur_node.parent
          i += 1
      return i
  
file_path: sphinx/sphinx/ext/autosectionlabel.py
imports: from __future__ import annotations
  from typing import TYPE_CHECKING, Any, cast
  from docutils import nodes
  import sphinx
  from sphinx.domains.std import StandardDomain
  from sphinx.locale import __
  from sphinx.util import logging
  from sphinx.util.nodes import clean_astext
label_desc: Use image node_id 1 for calling a global function with example usage: get_node_depth(node) and returns: i