code: def read_tfevents(logdir):
      """Returns Event protos read from a tfevents file in the directory.
  
      Args:
        logdir: string directory path to read
  
      Returns:
        A list of event_pb2.Event protos read from the file.
  
      Raises:
        RuntimeError: if there is not exactly one tfevents file present
            at the top level of the directory.
      """
      files_to_events = read_tfevents_files(logdir)
      if len(files_to_events) != 1:
          raise RuntimeError(
              "Expected single file but found %r"
              % list(files_to_events.keys())
          )
      return files_to_events.popitem()[1]
  
imports: import glob
  import os
  from tensorboard.compat.proto import event_pb2
  from tensorboard.compat.tensorflow_stub import errors
  from tensorboard.compat.tensorflow_stub import pywrap_tensorflow
label_desc: Use image node_id 2 for calling a global function with example usage: read_tfevents(logdir) and returns: files_to_events