code: def read_tb_logs_as_list(path, summary_name):
      """Reads a TensorBoard Events file from the input path, and returns the
      summary specified as input as a list.
  
      Arguments:
      path: str, path to the dir where the events file is located.
      summary_name: str, name of the summary to read from the TB logs.
      Output:
      summary_list: list, the values in the read summary list, formatted as a list.
      """
      files = glob.glob(f"{path}/events*tfevents*")
      files += glob.glob(f"{path}/results/events*tfevents*")
      files.sort(key=lambda x: os.path.getmtime(os.path.join(path, x)))
      if files:
          event_file = files[0]
          ea = event_accumulator.EventAccumulator(event_file)
          ea.Reload()
          summary = ea.Scalars(summary_name)
          summary_list = [round(x.value, 5) for x in summary]
          print(
              f"\nObtained the following list for {summary_name} ------------------"
          )
          print(summary_list)
          return summary_list
      raise FileNotFoundError(
          f"File not found matching: {path}/events*"
      )
  
imports: import os
  import sys
  import glob
  from tensorboard.backend.event_processing import event_accumulator
label_desc: Use image node_id 1 for calling a global function with example usage: read_tb_logs_as_list(path, summary_name) and returns: summary_list