code: def display_tooltips(
      node_selector,
      tooltip_key_attr,
      tooltips,
      container_selector="#output-body",
  ):
      tooltips_json = json.dumps(tooltips)
      html = """
    <script>
      var nodes = d3.selectAll("{node_selector}");
      var container = d3.select("{container_selector}");
      var tooltip_div = container.append("div");
      tooltip_div.classed("tooltip", true).style("opacity", "0.0");
  
      var tooltips = {tooltips_json};
  
      function show_node() {{
        var node = d3.select(this);
        var svg_box = container.node().getBoundingClientRect();
        var box = node.node().getBoundingClientRect();
        var name = node.attr("{tooltip_key_attr}");
  
        if (name in tooltips){{
          tooltip_div.html(tooltips[name]);
          tooltip_div.style("opacity", "1.0")
            .style("left", (box.x + 4 - svg_box.x)+"px")
            .style("top", (box.y + box.height + 12 - svg_box.y)+"px");
        }}
      }}
  
      d3.selectAll("{node_selector}")
        .on("mouseover", show_node)
        .on("mouseout", () => tooltip_div.style("opacity", "0.0") );
      </script>
      """.format(
          **locals()
      )
      # print(html)
      _display_html(html)
  
file_path: lucid/lucid/scratch/pretty_graphs/visualizations.py
imports: import numpy
  import tensorflow
  import json
  import lucid.modelzoo.vision_models
  from lucid.misc.io.showing import _image_url, _display_html
  from lucid.scratch.pretty_graphs.format_graph import complete_render_model_graph
  from lucid.misc.io import show, load
label_desc: Use image node_id 3 for calling a global function with example usage: display_tooltips(node_selector, tooltip_key_attr, tooltips, container_selector) without return types