code: def is_tfevents_file_created_by(
      path: str, hostname: Optional[str], start_time: Optional[float]
  ) -> bool:
      """Check if a path is a tfevents file.
  
      Optionally checks that it was created by [hostname] after [start_time].
  
      tensorboard tfevents filename format:
          https://github.com/tensorflow/tensorboard/blob/f3f26b46981da5bd46a5bb93fcf02d9eb7608bc1/tensorboard/summary/writer/event_file_writer.py#L81
      tensorflow tfevents filename format:
          https://github.com/tensorflow/tensorflow/blob/8f597046dc30c14b5413813d02c0e0aed399c177/tensorflow/core/util/events_writer.cc#L68
      """
      if not path:
          raise ValueError("Path must be a nonempty string")
      basename = os.path.basename(path)
      if basename.endswith(".profile-empty") or basename.endswith(
          ".sagemaker-uploaded"
      ):
          return False
      fname_components = basename.split(".")
      try:
          tfevents_idx = fname_components.index("tfevents")
      except ValueError:
          return False
      # check the hostname, which may have dots
      if hostname is not None:
          for i, part in enumerate(hostname.split(".")):
              try:
                  fname_component_part = fname_components[
                      tfevents_idx + 2 + i
                  ]
              except IndexError:
                  return False
              if part != fname_component_part:
                  return False
      if start_time is not None:
          try:
              created_time = int(fname_components[tfevents_idx + 1])
          except (ValueError, IndexError):
              return False
          # Ensure that the file is newer then our start time, and that it was
          # created from the same hostname.
          # TODO: we should also check the PID (also contained in the tfevents
          #     filename). Can we assume that our parent pid is the user process
          #     that wrote these files?
          if created_time < int(start_time):
              return False
      return True
  
imports: import glob
  import logging
  import os
  import queue
  import socket
  import sys
  import threading
  import time
  from typing import TYPE_CHECKING, Any, Dict, List, Optional
  import wandb
  from wandb import util
  from wandb.sdk.interface.interface import GlobStr
  from wandb.sdk.lib import filesystem
  from wandb.viz import CustomChart
  from .None import run
label_desc: Use image node_id 2 for calling a global function with example usage: is_tfevents_file_created_by(path, hostname, start_time) and returns: True, False, False, False, False, False, False