code: def main(build_type: str, path_out: Optional[str]) -> int:
      if build_type not in ("master", "agent", "sphinx"):
          print(__doc__, file=sys.stderr)
          return 1
  
      licenses = read_dir(
          os.path.join(os.path.dirname(__file__), "licenses")
      )
      our_license_path = os.path.join(
          os.path.dirname(__file__), "..", "..", "LICENSE"
      )
  
      if sys.argv[1] == "sphinx":
          gen = build_sphinx(licenses)
      elif sys.argv[1] == "master":
          gen = build_ascii(
              [
                  license
                  for license in licenses
                  if license.master or license.webui
              ],
              our_license_path,
          )
      elif sys.argv[1] == "agent":
          gen = build_ascii(
              [license for license in licenses if license.agent],
              our_license_path,
          )
  
      gen = post_process(gen)
  
      # Only write the output when we are sure we will not hit any other errors, to play nice
      # with build systems that look at timestamps on files.
      file_out = (
          open(path_out, "w") if path_out is not None else sys.stdout
      )
      with file_out:
          print(gen, file=file_out)
  
      return 0
  
file_path: determined/tools/scripts/gen-attributions.py
imports: import email
  import os
  import sys
  from typing import IO, List, Optional
label_desc: Use image node_id 8 for calling a global function with example usage: main(build_type, path_out) and returns: int, int