code: def GetNext(self):
      # Each new read should start at the beginning of any partial record.
      self._buffer_pos = 0
      # Read the header
      self.curr_event = None
      header_str = self._read(8)
      if not header_str:
          # Hit EOF so raise and exit
          raise errors.OutOfRangeError(
              None, None, "No more events to read"
          )
      if len(header_str) < 8:
          raise self._truncation_error("header")
      header = struct.unpack("<Q", header_str)
  
      # Read the crc32, which is 4 bytes, and check it against
      # the crc32 of the header
      crc_header_str = self._read(4)
      if len(crc_header_str) < 4:
          raise self._truncation_error("header crc")
      crc_header = struct.unpack("<I", crc_header_str)
      header_crc_calc = masked_crc32c(header_str)
      if header_crc_calc != crc_header[0]:
          raise errors.DataLossError(
              None,
              None,
              "{} failed header crc32 check".format(self.filename),
          )
  
      # The length of the header tells us how many bytes the Event
      # string takes
      header_len = int(header[0])
      event_str = self._read(header_len)
      if len(event_str) < header_len:
          raise self._truncation_error("data")
  
      event_crc_calc = masked_crc32c(event_str)
  
      # The next 4 bytes contain the crc32 of the Event string,
      # which we check for integrity.
      crc_event_str = self._read(4)
      if len(crc_event_str) < 4:
          raise self._truncation_error("data crc")
      crc_event = struct.unpack("<I", crc_event_str)
      if event_crc_calc != crc_event[0]:
          raise errors.DataLossError(
              None,
              None,
              "{} failed event crc32 check".format(self.filename),
          )
  
      # Set the current event to be read later by record() call
      self.curr_event = event_str
      # Clear the buffered partial record since we're done reading it.
      self._buffer = b""
  
file_path: tensorboard/tensorboard/compat/tensorflow_stub/pywrap_tensorflow.py
imports: import array
  import struct
  from .None import errors
  from .io import gfile
label_desc: Use image node_id 2 for calling the PyRecordReader_New obj's underlying member method code with example usage: obj.GetNext() without return types