code: def write_header(self, use_compression_type=True):
      batch_len = len(self._buffer)
      self.HEADER_STRUCT.pack_into(
          self._buffer,
          0,
          0,  # BaseOffset, set by broker
          batch_len - self.AFTER_LEN_OFFSET,  # Size from here to end
          0,  # PartitionLeaderEpoch, set by broker
          self._magic,
          0,  # CRC will be set below, as we need a filled buffer for it
          self._get_attributes(use_compression_type),
          self._last_offset,
          self._first_timestamp,
          self._max_timestamp,
          self._producer_id,
          self._producer_epoch,
          self._base_sequence,
          self._num_records,
      )
      crc = calc_crc32c(self._buffer[self.ATTRIBUTES_OFFSET :])
      struct.pack_into(">I", self._buffer, self.CRC_OFFSET, crc)
  
imports: import struct
  import time
  from kafka.record.abc import ABCRecord, ABCRecordBatch, ABCRecordBatchBuilder
  from kafka.record.util import decode_varint, encode_varint, calc_crc32c, size_of_varint
  from kafka.errors import CorruptRecordException, UnsupportedCodecError
  from kafka.codec import gzip_encode, snappy_encode, lz4_encode, zstd_encode, gzip_decode, snappy_decode, lz4_decode, zstd_decode
  import kafka.codec
label_desc: Use image node_id 4 for calling the DefaultRecordBatchBuilder obj's underlying member method code with example usage: obj.write_header(use_compression_type) without return types