code: def add_html_cache_busting(
      app, pagename, templatename, context, doctree
  ):
      """
      Add cache busting query on CSS and JavaScript assets.
  
      This adds the Matplotlib version as a query to the link reference in the
      HTML, if the path is not absolute (i.e., it comes from the `_static`
      directory) and doesn't already have a query.
  
      .. note:: Sphinx 7.1 provides asset checksums; so this hook only runs on
                Sphinx 7.0 and earlier.
      """
      from sphinx.builders.html import Stylesheet, JavaScript
  
      css_tag = context["css_tag"]
      js_tag = context["js_tag"]
  
      def css_tag_with_cache_busting(css):
          if isinstance(css, Stylesheet) and css.filename is not None:
              url = urlsplit(css.filename)
              if not url.netloc and not url.query:
                  url = url._replace(query=SHA)
                  css = Stylesheet(
                      urlunsplit(url),
                      priority=css.priority,
                      **css.attributes,
                  )
          return css_tag(css)
  
      def js_tag_with_cache_busting(js):
          if isinstance(js, JavaScript) and js.filename is not None:
              url = urlsplit(js.filename)
              if not url.netloc and not url.query:
                  url = url._replace(query=SHA)
                  js = JavaScript(
                      urlunsplit(url),
                      priority=js.priority,
                      **js.attributes,
                  )
          return js_tag(js)
  
      context["css_tag"] = css_tag_with_cache_busting
      context["js_tag"] = js_tag_with_cache_busting
  
file_path: matplotlib/doc/conf.py
imports: from datetime import datetime, timezone
  import logging
  import os
  from pathlib import Path
  import shutil
  import subprocess
  import sys
  import time
  from urllib.parse import urlsplit, urlunsplit
  import warnings
  import sphinx
  import yaml
  import matplotlib
  import sphinxext.gallery_order
  from sphinx_gallery import gen_rst
label_desc: Use image node_id 4 for calling a global function with example usage: add_html_cache_busting(app, pagename, templatename, context, doctree) and returns: css_tag, js_tag