code: def add_custom_assets(
      app: sphinx.application.Sphinx,
      pagename: str,
      templatename: str,
      context: Dict[str, Any],
      doctree: nodes.Node,
  ):
      """Add custom per-page assets.
  
      See documentation on Sphinx Core Events for more information:
      https://www.sphinx-doc.org/en/master/extdev/appapi.html#sphinx-core-events
      """
      if pagename == "index":
          app.add_css_file("css/index.css")
          app.add_js_file("js/index.js")
          return "index.html"  # Use the special index.html template for this page
  
      if pagename == "train/train":
          app.add_css_file("css/ray-train.css")
      elif pagename == "ray-overview/examples":
          # Example gallery
          app.add_css_file("css/examples.css")
          app.add_js_file("js/examples.js")
      elif pagename == "ray-overview/ray-libraries":
          app.add_css_file("css/ray-libraries.css")
  
imports: from typing import Dict, Any
  from datetime import datetime
  from importlib import import_module
  import os
  import sys
  from jinja2.filters import FILTERS
  import sphinx
  from sphinx.ext import autodoc
  from docutils import nodes
  import pathlib
  import logging
  from custom_directives import DownloadAndPreprocessEcosystemDocs, update_context, LinkcheckSummarizer, parse_navbar_config, setup_context
  import packaging.version
  from setup import find_version
label_desc: Use image node_id 3 for calling a global function with example usage: add_custom_assets(app, pagename, templatename, context, doctree) and returns: str