code: def __init__(self, buffer, magic):
      self._buffer = memoryview(buffer)
      self._magic = magic
  
      offset, length, crc, magic_, attrs, timestamp = self._read_header(
          0
      )
      assert length == len(buffer) - self.LOG_OVERHEAD
      assert magic == magic_
  
      self._offset = offset
      self._crc = crc
      self._timestamp = timestamp
      self._attributes = attrs
      self._decompressed = False
  
imports: import struct
  import time
  from kafka.record.abc import ABCRecord, ABCRecordBatch, ABCRecordBatchBuilder
  from kafka.record.util import calc_crc32
  from kafka.codec import gzip_encode, snappy_encode, lz4_encode, lz4_encode_old_kafka, gzip_decode, snappy_decode, lz4_decode, lz4_decode_old_kafka
  import kafka.codec
  from kafka.errors import CorruptRecordException, UnsupportedCodecError
label_desc: Use image node_id 1 to create a new LegacyRecordBatch object from inherited base classes: ABCRecordBatch, LegacyRecordBase with example: obj = LegacyRecordBatch(buffer, magic)