code: def add_uids(doctree: Node, condition: Any) -> Iterator[Node]:
      """Add a unique id to every node in the `doctree` which matches the
      condition and yield the nodes.
  
      :param doctree:
          A :class:`docutils.nodes.document` instance.
  
      :param condition:
          A callable which returns either ``True`` or ``False`` for a given node.
      """
      for node in doctree.findall(condition):
          node.uid = uuid4().hex
          yield node
  
file_path: sphinx/sphinx/versioning.py
imports: from __future__ import annotations
  import pickle
  from itertools import product, zip_longest
  from operator import itemgetter
  from os import path
  from typing import TYPE_CHECKING, Any
  from uuid import uuid4
  from sphinx.transforms import SphinxTransform
label_desc: Use image node_id 1 for calling a global function with example usage: add_uids(doctree, condition) without return types