code: def write_short_bytes(b):
      
      if b is None:
          return _NULL_SHORT_STRING
      if not isinstance(b, bytes):
          raise TypeError('{!r} is not bytes'.format(b))
      elif len(b) > 32767:
          raise struct.error(len(b))
      else:
          return struct.pack('>h', len(b)) + b
docs: Encode a Kafka short string which contains arbitrary bytes. A short string
      is limited to 32767 bytes in length by the signed 16-bit length prefix.
      A length prefix of -1 indicates ``null``, represented as ``None`` in
      Python.
  
      :param bytes b:
          No more than 32767 bytes, or ``None`` for the null encoding.
      :return: length-prefixed `bytes`
      :raises:
          `struct.error` for strings longer than 32767 characters