code: def configure_wasi_python(context, working_dir):
      """Configure the WASI/host build."""
      if (
          not context.wasi_sdk_path
          or not context.wasi_sdk_path.exists()
      ):
          raise ValueError(
              "WASI-SDK not found; "
              "download from "
              "https://github.com/WebAssembly/wasi-sdk and/or "
              "specify via $WASI_SDK_PATH or --wasi-sdk"
          )
  
      config_site = os.fsdecode(
          CHECKOUT / "Tools" / "wasm" / "config.site-wasm32-wasi"
      )
  
      wasi_build_dir = working_dir.relative_to(CHECKOUT)
  
      python_build_dir = BUILD_DIR / "build"
      lib_dirs = list(python_build_dir.glob("lib.*"))
      assert (
          len(lib_dirs) == 1
      ), f"Expected a single lib.* directory in {python_build_dir}"
      lib_dir = os.fsdecode(lib_dirs[0])
      pydebug = lib_dir.endswith("-pydebug")
      python_version = lib_dir.removesuffix("-pydebug").rpartition("-")[
          -1
      ]
      sysconfig_data = (
          f"{wasi_build_dir}/build/lib.wasi-wasm32-{python_version}"
      )
      if pydebug:
          sysconfig_data += "-pydebug"
  
      # Use PYTHONPATH to include sysconfig data which must be anchored to the
      # WASI guest's `/` directory.
      host_runner = context.host_runner.format(
          GUEST_DIR="/",
          HOST_DIR=CHECKOUT,
          ENV_VAR_NAME="PYTHONPATH",
          ENV_VAR_VALUE=f"/{sysconfig_data}",
          PYTHON_WASM=working_dir / "python.wasm",
      )
      env_additions = {
          "CONFIG_SITE": config_site,
          "HOSTRUNNER": host_runner,
      }
      build_python = os.fsdecode(build_python_path())
      # The path to `configure` MUST be relative, else `python.wasm` is unable
      # to find the stdlib due to Python not recognizing that it's being
      # executed from within a checkout.
      configure = [
          os.path.relpath(CHECKOUT / "configure", working_dir),
          f"--host={HOST_TRIPLE}",
          f"--build={build_platform()}",
          f"--with-build-python={build_python}",
      ]
      if pydebug:
          configure.append("--with-pydebug")
      if context.args:
          configure.extend(context.args)
      call(
          configure,
          env=updated_env(env_additions | wasi_sdk_env(context)),
          quiet=context.quiet,
      )
  
      python_wasm = working_dir / "python.wasm"
      exec_script = working_dir / "python.sh"
      with exec_script.open("w", encoding="utf-8") as file:
          file.write(
              f'#!/bin/sh\nexec {host_runner} {python_wasm} "$@"\n'
          )
      exec_script.chmod(0o755)
      print(f"🏃‍♀️ Created {exec_script} ... ")
      sys.stdout.flush()
  
imports: import argparse
  import contextlib
  import functools
  import os
  import pathlib
  import shutil
  import subprocess
  import sys
  import sysconfig
  import tempfile
label_desc: Use image node_id 10 for calling a global function with example usage: configure_wasi_python(context, working_dir) without return types