code: def construct_build_args(
      *,
      context_path: PathType = ".",
      build_arg: dict[str, str] | ArgType = None,
      cache_from: str | dict[str, str] | ArgType = None,
      cache_to: str | dict[str, str] | ArgType = None,
      label: dict[str, str] | ArgType = None,
      output: str | dict[str, str] | ArgType = None,
      secret: str | dict[str, str] | ArgType = None,
      **kwargs: t.Any,
  ) -> Arguments:
      cmds = Arguments()
  
      if isinstance(build_arg, dict):
          build_arg = tuple(
              f"{key}={value}" for key, value in build_arg.items()
          )
      cmds.construct_args(build_arg, opt="build-arg")
      if isinstance(cache_from, dict):
          cache_from = parse_dict_opt(cache_from)
      cmds.construct_args(cache_from, opt="cache-from")
      if isinstance(cache_to, dict):
          cache_to = parse_dict_opt(cache_to)
      cmds.construct_args(cache_to, opt="cache-to")
      if isinstance(label, dict):
          label = tuple(
              f"{key}={value}" for key, value in label.items()
          )
      cmds.construct_args(label, opt="label")
      if isinstance(output, dict):
          output = parse_dict_opt(output)
      cmds.construct_args(output, opt="output")
      if isinstance(secret, dict):
          secret = parse_dict_opt(secret)
      cmds.construct_args(secret, opt="secret")
  
      for k, v in kwargs.items():
          cmds.construct_args(v, opt=k.replace("_", "-"))
  
      cmds.append(str(context_path))
  
      return cmds
  
file_path: BentoML/src/bentoml/_internal/container/nerdctl.py
imports: from __future__ import annotations
  import logging
  import os
  import shutil
  import typing
  from typing import TYPE_CHECKING
  import psutil
  from .base import Arguments
label_desc: Use image node_id 4 for calling a global function with example usage: construct_build_args() and returns: cmds