code: def extra_template_vars(
      template, database, table, view_name, request, datasette
  ):
      # This helps unit tests that want to run assertions against the request object:
      datasette._last_request = request
  
      async def query_database(sql):
          first_db = list(datasette.databases.keys())[0]
          return (await datasette.execute(first_db, sql)).rows[0][0]
  
      async def inner():
          return {
              "extra_template_vars_from_awaitable": json.dumps(
                  {
                      "template": template,
                      "scope_path": request.scope["path"]
                      if request
                      else None,
                      "awaitable": True,
                  },
                  default=lambda b: b.decode("utf8"),
              ),
              "query_database": query_database,
          }
  
      return inner
  
file_path: datasette/tests/plugins/my_plugin_2.py
imports: from datasette import hookimpl
  from datasette.utils.asgi import Response
  from functools import wraps
  import markupsafe
  import json
label_desc: Use image node_id 3 for calling a global function with example usage: extra_template_vars(template, database, table, view_name, request, datasette) and returns: inner, unknown, dict