code: def wasi_sdk_env(context):
      """Calculate environment variables for building with wasi-sdk."""
      wasi_sdk_path = context.wasi_sdk_path
      sysroot = wasi_sdk_path / "share" / "wasi-sysroot"
      env = {
          "CC": "clang",
          "CPP": "clang-cpp",
          "CXX": "clang++",
          "LDSHARED": "wasm-ld",
          "AR": "llvm-ar",
          "RANLIB": "ranlib",
      }
  
      for env_var, binary_name in list(env.items()):
          env[env_var] = os.fsdecode(
              wasi_sdk_path / "bin" / binary_name
          )
  
      if wasi_sdk_path != pathlib.Path("/opt/wasi-sdk"):
          for compiler in ["CC", "CPP", "CXX"]:
              env[compiler] += f" --sysroot={sysroot}"
  
      env["PKG_CONFIG_PATH"] = ""
      env["PKG_CONFIG_LIBDIR"] = os.pathsep.join(
          map(
              os.fsdecode,
              [
                  sysroot / "lib" / "pkgconfig",
                  sysroot / "share" / "pkgconfig",
              ],
          )
      )
      env["PKG_CONFIG_SYSROOT_DIR"] = os.fsdecode(sysroot)
  
      env["WASI_SDK_PATH"] = os.fsdecode(wasi_sdk_path)
      env["WASI_SYSROOT"] = os.fsdecode(sysroot)
  
      env["PATH"] = os.pathsep.join(
          [os.fsdecode(wasi_sdk_path / "bin"), os.environ["PATH"]]
      )
  
      return env
  
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 9 for calling a global function with example usage: wasi_sdk_env(context) and returns: env