code: def build_handler(args):
      """Builds a firmware image given a project dir."""
      project_dir = get_project_dir(args.project_dir)
  
      if not os.path.exists(project_dir):
          raise TVMCException(f"{project_dir} doesn't exist.")
  
      if os.path.exists(project_dir + "/build"):
          if args.force:
              shutil.rmtree(project_dir + "/build")
          else:
              raise TVMCException(
                  f"There is already a build in {project_dir}. "
                  "To force rebuild it use '-f' or '--force'."
              )
  
      options = get_and_check_options(
          args.project_option, args.valid_options
      )
  
      try:
          prj = project.GeneratedProject.from_directory(
              project_dir, options=options
          )
          prj.build()
      except ServerError as error:
          print(
              "The following error occurred on the Project API server side: ",
              error,
          )
          sys.exit(1)
  
file_path: tvm/python/tvm/driver/tvmc/micro.py
imports: import argparse
  import os
  from pathlib import Path
  import shutil
  import sys
  from .None import TVMCException
  from .main import register_parser
  from .arguments import TVMCSuppressedArgumentParser
  from .project import get_project_options, get_and_check_options, get_project_dir
label_desc: Use image node_id 4 for calling a global function with example usage: build_handler(args) without return types