code: def base_layout(app_root, **kwargs):
      """
      Base layout to be returned by :meth:`dtale.dash_application.views.DtaleDash.interpolate_index`
  
      :param kwargs: Optional keyword arguments to be passed to 'dash.Dash.interplolate_index'
      :type kwargs: dict
      :return: HTML
      :rtype: str
      """
      webroot_html = ""
      favicon_path = "../../dtale/static/images/favicon.png"
      if is_app_root_defined(app_root):
          webroot_html = """
          <script type="text/javascript">
              window.resourceBaseUrl = '{app_root}';
          </script>
          """.format(
              app_root=app_root
          )
          favicon_path = "{}/dtale/static/images/favicon.png".format(
              app_root
          )
      grid_links = []
      for id in global_state.keys():
          label = global_state.get_name(id)
          if label:
              label = " ({})".format(label)
          else:
              label = ""
          grid_links.append(
              (
                  """<a href="../main/{id}" class="dropdown-item data-grid-link" target="{target}">"""
                  """<span class="ml-3">{id}{label}</span>"""
                  """</a>"""
              ).format(
                  id=id,
                  label=label,
                  target="_self"
                  if os.environ.get("VSCODE_PID") is not None
                  else "_blank",
              )
          )
      language = global_state.get_app_settings()["language"]
      language_links = []
      for value, label in [
          ("en", "English"),
          ("cn", "Chinese"),
          ("pt", "Portuguese"),
      ]:
          if value == language:
              language_links.append(
                  """<span class="dropdown-item active">{}</span>""".format(
                      "&#10003; {}".format(text(label))
                  )
              )
          else:
              language_links.append(
                  """<a href="{}" class="dropdown-item lang-link">{}</a>""".format(
                      value, text(label)
                  )
              )
  
      main_title = (
          global_state.get_app_settings().get("main_title") or "D-TALE"
      )
      main_title_font = global_state.get_app_settings().get(
          "main_title_font"
      )
      main_title_class = "title-font-base"
      main_title_style = ""
      if main_title_font:
          main_title_style = "font-family: {main_title_font}".format(
              main_title_font=main_title_font
          )
      else:
          main_title_class = "title-font title-font-base"
      page_title = (
          global_state.get_app_settings().get("main_title") or "D-Tale"
      )
  
      return """
          <!DOCTYPE html>
          <html>
              <head>
                  {webroot_html}
                  {metas}
                  <title>{page_title} Charts</title>
                  <link rel="shortcut icon" href="{favicon_path}">
                  {css}
              </head>
              <body class="{theme}-mode">
                  <header class="app-header">
                      <span class="{main_title_class}" style="{main_title_style}">{main_title}</span>
                      <span style="font-size: 16px" class="pl-5 mt-4">{title}</span>
                      <nav class="app-header__nav--secondary">
                          <ul class="nav-menus">
                              <li>
                                  <div class="dropdown">
                                      <span class="dropbtn nav-link dropdown-toggle">
                                          {back_to_data}
                                      </span>
                                      <div class="dropdown-content">{grid_links}</div>
                                  </div>
                              </li>
                              <li>
                                  <div class="dropdown">
                                      <span class="dropbtn nav-link dropdown-toggle">
                                          {languages}
                                      </span>
                                      <div class="dropdown-content">{language_links}</div>
                                  </div>
                              </li>
                          </ul>
                      </nav>
                  </header>
                  <div class="container-fluid charts">
                      {app_entry}
                  </div>
                  <footer>
                      {config}
                      {scripts}
                      <script type="text/javascript">
                          const pathSegs = window.location.pathname.split('/');
                          const dataId = pathSegs[pathSegs.length - 1];
                          const backToData = () => window.open('{app_root}/dtale/main/' + dataId);
                      </script>
                      {renderer}
                      {css}
                  </footer>
              </body>
          </html>
      """.format(
          metas=kwargs["metas"],
          css=kwargs["css"],
          app_entry=kwargs["app_entry"],
          config=kwargs["config"],
          scripts=kwargs["scripts"],
          renderer=kwargs["renderer"],
          webroot_html=webroot_html,
          app_root=app_root if is_app_root_defined(app_root) else "",
          favicon_path=favicon_path,
          title=text("Charts"),
          back_to_data=text("Back To Data"),
          grid_links="".join(grid_links),
          languages=text("Languages"),
          language_links="".join(language_links),
          main_title=main_title,
          main_title_class=main_title_class,
          main_title_style=main_title_style,
          page_title=page_title,
          theme=global_state.get_app_settings()["theme"],
      )
  
imports: import json
  import dash_bootstrap_components
  import dash_colorscales
  import dash_daq
  import os
  import plotly
  from pkg_resources import parse_version
  from six import PY3
  from dtale.dash_application import dcc, html
  import dtale.dash_application.custom_geojson
  import dtale.dash_application.extended_aggregations
  import dtale.global_state
  from dtale.charts.utils import AGGS, ANIMATION_CHARTS, ANIMATE_BY_CHARTS, YAXIS_CHARTS, ZAXIS_CHARTS, NON_EXT_AGGREGATION, build_final_cols, find_group_vals
  from dtale.column_builders import get_cleaner_configs
  from dtale.constants import CHART_JOINER_CHAR
  from dtale.dash_application.layout.utils import build_input, build_option, build_tab, build_cols, build_hoverable, build_selections, show_style, FREQS, FREQ_LABELS
  from dtale.translations import text
  from dtale.query import build_query, handle_predefined, inner_build_query, run_query
  from dtale.utils import ChartBuildingError, classify_type, coord_type, get_dtypes, is_app_root_defined, make_list
label_desc: Use image node_id 4 for calling a global function with example usage: base_layout(app_root) and returns: str