code: def size_of(cls, key, value, headers):
      size = 0
      # Key size
      if key is None:
          size += 1
      else:
          key_len = len(key)
          size += size_of_varint(key_len) + key_len
      # Value size
      if value is None:
          size += 1
      else:
          value_len = len(value)
          size += size_of_varint(value_len) + value_len
      # Header size
      size += size_of_varint(len(headers))
      for h_key, h_value in headers:
          h_key_len = len(h_key.encode("utf-8"))
          size += size_of_varint(h_key_len) + h_key_len
  
          if h_value is None:
              size += 1
          else:
              h_value_len = len(h_value)
              size += size_of_varint(h_value_len) + h_value_len
      return size
  
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 9 for calling the DefaultRecordBatchBuilder obj's underlying member method code with example usage: obj.size_of(cls, key, value, headers) and returns: size