code: def __init__(self, magic, compression_type, batch_size):
      self._magic = magic
      self._compression_type = compression_type
      self._batch_size = batch_size
      self._buffer = bytearray()
  
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 LegacyRecordBatchBuilder object from inherited base classes: ABCRecordBatchBuilder, LegacyRecordBase with example: obj = LegacyRecordBatchBuilder(magic, compression_type, batch_size)