code: def main():
      # Generate help from module docstring.
      description = __doc__
      summary, _, details = description.partition("\n\n")
      parser = argparse.ArgumentParser(
          prog="convert_tbdev_export.py",
          description=summary,
          epilog=details,
          formatter_class=argparse.RawDescriptionHelpFormatter,
      )
      parser.add_argument(
          "exp_dir",
          metavar="EXPERIMENT-DIRECTORY",
          help="Exported experiment directory to convert",
      )
      parser.add_argument(
          "-o", "--outdir", help="Optional output directory to write to"
      )
      parser.add_argument(
          "-f",
          "--force",
          action="store_true",
          help=(
              "If True, continue even if input directory name is not in"
              "the expected format"
          ),
      )
      parser.add_argument(
          "-v",
          "--verbose",
          action="store_true",
          help="If True, print a list of the resulting files",
      )
      args = parser.parse_args()
      # Normalize, and in particular strip trailing slash if provided.
      exp_dir = os.path.normpath(args.exp_dir)
      if not os.path.exists(exp_dir):
          logging.error("Input directory not found: %s", exp_dir)
          exit(1)
      if not os.path.isdir(exp_dir):
          logging.error("Input is not a directory: %s", exp_dir)
          exit(1)
      exp_dir_base = os.path.basename(exp_dir)
      if not _EXP_DIR_REGEX.fullmatch(exp_dir_base):
          msg = (
              "Input directory name %r does not match expected format %r. "
              % (
                  exp_dir_base,
                  _EXP_DIR_REGEX.pattern,
              )
          )
          if args.force:
              logging.warning(msg + "Continuing anyway due to --force.")
          if not args.force:
              logging.error(
                  msg + "Pass --force to attempt conversion anyway."
              )
              exit(1)
      out_dir = args.outdir
      if not out_dir:
          out_dir = tempfile.mkdtemp(
              prefix="tbdev-export-converter-%s-" % exp_dir_base
          )
      if not os.path.exists(out_dir):
          logging.error("Output directory must exist: %s", out_dir)
          exit(1)
      if not os.path.isdir(out_dir):
          logging.error("Output is not a directory: %s", out_dir)
          exit(1)
  
      convert(exp_dir, out_dir)
  
      if not args.outdir:
          print(f"Results of conversion in: {out_dir}")
      if args.verbose:
          for dirpath, dirnames, filenames in os.walk(out_dir):
              print(dirpath)
              for name in filenames:
                  print(os.path.join(dirpath, name))
  
file_path: tensorboard/tensorboard/tools/convert_tbdev_export.py
imports: import argparse
  import base64
  import collections
  import json
  import logging
  import os
  import re
  import tempfile
  from tensorboard.compat.proto.event_pb2 import Event
  from tensorboard.compat.proto.summary_pb2 import Summary
  from tensorboard.summary.writer.event_file_writer import EventFileWriter
  from tensorboard.util import tensor_util
label_desc: Use image node_id 8 for calling a global function with example usage: main() without return types