code: def get_node_line(node: Element) -> int:
      for pnode in traverse_parent(node):
          if pnode.line:
              return pnode.line
      msg = "node line not found"
      raise ValueError(msg)
  
imports: from __future__ import annotations
  import contextlib
  import re
  import unicodedata
  from typing import TYPE_CHECKING, Any, Callable
  from docutils import nodes
  from sphinx import addnodes
  from sphinx.locale import __
  from sphinx.util import logging
label_desc: Use image node_id 7 for calling a global function with example usage: get_node_line(node) and returns: pnode