code: def build(
      tags: List[str],
      file: str,
      context_path: str,
      platform: Optional[str] = None,
  ) -> str:
      use_buildx = is_buildx_installed()
      command = ["buildx", "build"] if use_buildx else ["build"]
      command += (
          ["--load"]
          if should_add_load_argument(platform) and use_buildx
          else []
      )
      if platform:
          command += ["--platform", platform]
      build_tags = []
      for tag in tags:
          build_tags += ["-t", tag]
      args = (
          ["docker"] + command + build_tags + ["-f", file, context_path]
      )
      stdout = run_command_live_output(
          args,
      )
      return stdout
  
imports: import json
  import logging
  import os
  import subprocess
  from typing import Any, Dict, List, Optional, Tuple, Union
  import requests
  from dockerpycreds.utils import find_executable
  from wandb.docker import auth, www_authenticate
  from wandb.errors import Error
label_desc: Use image node_id 4 for calling a global function with example usage: build(tags, file, context_path, platform) and returns: stdout