code: def events_from_logdir(logdir):
      """Returns all events in the single eventfile in logdir.
  
      Args:
        logdir: The directory in which the single event file is sought.
  
      Returns:
        A list of all tf.compat.v1.Event protos from the single event file.
  
      Raises:
        AssertionError: If logdir does not contain exactly one file.
      """
      assert gfile.Exists(logdir)
      files = gfile.ListDirectory(logdir)
      assert len(files) == 1, (
          "Found not exactly one file in logdir: %s" % files
      )
      return events_from_file(os.path.join(logdir, files[0]))
  
imports: import os
  from tensorflow.core.util import event_pb2
  from tensorflow.python.lib.io import tf_record
  from tensorflow.python.platform import gfile
label_desc: Use image node_id 2 for calling a global function with example usage: events_from_logdir(logdir) and returns: events_from_file