code: def test_rdrh002_with_custom_renderer_interpolated(dash_duo):
      renderer = """
          <script id="_dash-renderer" type="application/javascript">
              console.log('firing up a custom renderer!')
              const renderer = new DashRenderer({
                  request_pre: () => {
                      var output = document.getElementById('output-pre')
                      if(output) {
                          output.innerHTML = 'request_pre was here!';
                      }
                  },
                  request_post: () => {
                      var output = document.getElementById('output-post')
                      if(output) {
                          output.innerHTML = 'request_post!!!';
                      }
                  }
              })
          </script>
      """
  
      class CustomDash(Dash):
          def interpolate_index(self, **kwargs):
              return """<!DOCTYPE html>
              <html>
                  <head>
                      <title>My App</title>
                  </head>
                  <body>
  
                      <div id="custom-header">My custom header</div>
                      {app_entry}
                      {config}
                      {scripts}
                      {renderer}
                      <div id="custom-footer">My custom footer</div>
                  </body>
              </html>""".format(
                  app_entry=kwargs["app_entry"],
                  config=kwargs["config"],
                  scripts=kwargs["scripts"],
                  renderer=renderer,
              )
  
      app = CustomDash()
  
      app.layout = html.Div(
          [
              dcc.Input(id="input", value="initial value"),
              html.Div(
                  html.Div(
                      [
                          html.Div(id="output-1"),
                          html.Div(id="output-pre"),
                          html.Div(id="output-post"),
                      ]
                  )
              ),
          ]
      )
  
      @app.callback(
          Output("output-1", "children"), [Input("input", "value")]
      )
      def update_output(value):
          return value
  
      dash_duo.start_server(app)
  
      input1 = dash_duo.find_element("#input")
      dash_duo.clear_input(input1)
  
      input1.send_keys("fire request hooks")
  
      dash_duo.wait_for_text_to_equal("#output-1", "fire request hooks")
      assert (
          dash_duo.find_element("#output-pre").text
          == "request_pre was here!"
      )
      assert (
          dash_duo.find_element("#output-post").text
          == "request_post!!!"
      )
      assert (
          dash_duo.find_element("#custom-header").text
          == "My custom header"
      )
      assert (
          dash_duo.find_element("#custom-footer").text
          == "My custom footer"
      )
  
      assert dash_duo.get_logs() == []
  
file_path: dash/tests/integration/renderer/test_request_hooks.py
imports: import json
  import functools
  import flask
  import pytest
  from dash import Dash, Output, Input, html, dcc
  from dash.types import RendererHooks
  from werkzeug.exceptions import HTTPException
label_desc: Use image node_id 2 for calling a global function with example usage: test_rdrh002_with_custom_renderer_interpolated(dash_duo) and returns: value, str