code: def test_clsd002_chained_serverside_clientside_callbacks(dash_duo):
      app = Dash(__name__, assets_folder="assets")
  
      app.layout = html.Div(
          [
              html.Label("x"),
              dcc.Input(id="x", value=3),
              html.Label("y"),
              dcc.Input(id="y", value=6),
              # clientside
              html.Label("x + y (clientside)"),
              dcc.Input(id="x-plus-y"),
              # server-side
              html.Label("x+y / 2 (serverside)"),
              dcc.Input(id="x-plus-y-div-2"),
              # server-side
              html.Div(
                  [
                      html.Label("Display x, y, x+y/2 (serverside)"),
                      dcc.Textarea(id="display-all-of-the-values"),
                  ]
              ),
              # clientside
              html.Label("Mean(x, y, x+y, x+y/2) (clientside)"),
              dcc.Input(id="mean-of-all-values"),
          ]
      )
  
      app.clientside_callback(
          ClientsideFunction("clientside", "add"),
          Output("x-plus-y", "value"),
          [Input("x", "value"), Input("y", "value")],
      )
  
      call_counts = {"divide": Value("i", 0), "display": Value("i", 0)}
  
      @app.callback(
          Output("x-plus-y-div-2", "value"),
          [Input("x-plus-y", "value")],
      )
      def divide_by_two(value):
          call_counts["divide"].value += 1
          return float(value) / 2.0
  
      @app.callback(
          Output("display-all-of-the-values", "value"),
          [
              Input("x", "value"),
              Input("y", "value"),
              Input("x-plus-y", "value"),
              Input("x-plus-y-div-2", "value"),
          ],
      )
      def display_all(*args):
          call_counts["display"].value += 1
          return "\n".join([str(a) for a in args])
  
      app.clientside_callback(
          ClientsideFunction("clientside", "mean"),
          Output("mean-of-all-values", "value"),
          [
              Input("x", "value"),
              Input("y", "value"),
              Input("x-plus-y", "value"),
              Input("x-plus-y-div-2", "value"),
          ],
      )
  
      dash_duo.start_server(app)
  
      test_cases = [
          ["#x", "3"],
          ["#y", "6"],
          ["#x-plus-y", "9"],
          ["#x-plus-y-div-2", "4.5"],
          ["#display-all-of-the-values", "3\n6\n9\n4.5"],
          ["#mean-of-all-values", str((3 + 6 + 9 + 4.5) / 4.0)],
      ]
      for selector, expected in test_cases:
          dash_duo.wait_for_text_to_equal(selector, expected)
  
      assert call_counts["display"].value == 1
      assert call_counts["divide"].value == 1
  
      x_input = dash_duo.wait_for_element_by_css_selector("#x")
      x_input.send_keys("1")
  
      test_cases = [
          ["#x", "31"],
          ["#y", "6"],
          ["#x-plus-y", "37"],
          ["#x-plus-y-div-2", "18.5"],
          ["#display-all-of-the-values", "31\n6\n37\n18.5"],
          ["#mean-of-all-values", str((31 + 6 + 37 + 18.5) / 4.0)],
      ]
      for selector, expected in test_cases:
          dash_duo.wait_for_text_to_equal(selector, expected)
  
      assert call_counts["display"].value == 2
      assert call_counts["divide"].value == 2
  
imports: from multiprocessing import Value, Lock
  from dash import Dash, Input, Output, State, ClientsideFunction, ALL, html, dcc
  from selenium.webdriver.common.keys import Keys
label_desc: Use image node_id 2 for calling a global function with example usage: test_clsd002_chained_serverside_clientside_callbacks(dash_duo) and returns: unknown, str