code: def setup_tensorboard(flags):
      """Creates summary writers, and setups default tensorboard paths."""
      if not flags.tensorboard:
          return
  
      # --- Do not allow experiment with same name
      assert not tf.io.gfile.exists(
          flags.logdir
      ) or not tf.io.gfile.listdir(
          flags.logdir
      ), "CRITICAL: folder {} already exists".format(
          flags.logdir
      )
  
      # --- Log where summary can be found
      print("View results with: ")
      termcolor.cprint(
          "  tensorboard --logdir {}".format(flags.logdir), "red"
      )
      writer = tf.summary.create_file_writer(
          flags.logdir, flush_millis=10000
      )
      writer.set_as_default()
  
      # --- Log dir name tweak for "hypertune"
      log_dir = ""
      trial_id = int(os.environ.get("CLOUD_ML_TRIAL_ID", 0))
      if trial_id != 0:
          if log_dir.endswith(os.sep):
              log_dir = log_dir[:-1]  # removes trailing "/"
          log_dir += "_trial{0:03d}/".format(trial_id)
  
file_path: graphics/tensorflow_graphics/projects/pointnet/helpers.py
imports: from __future__ import print_function
  import argparse
  import os
  import tempfile
  import time
  import tensorflow
  import termcolor
label_desc: Use image node_id 4 for calling a global function with example usage: setup_tensorboard(flags) without return types