code: def record_size(cls, magic, key, value):
      message_size = cls.record_overhead(magic)
      if key is not None:
          message_size += len(key)
      if value is not None:
          message_size += len(value)
      return message_size
  
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 8 for calling the LegacyRecordBatchBuilder obj's underlying member method code with example usage: obj.record_size(cls, magic, key, value) and returns: message_size