code: def encode_ipmb_msg(header, data):
      
      msg = array('B')
  
      msg.fromstring(header.encode())
      if data is not None:
          a = array('B')
          a.fromstring(data)
          msg.extend(a)
      msg.append(checksum(msg[3:]))
      return msg.tostring()
docs: Encode an IPMB message.
  
      header: IPMB header object
      data: IPMI message data as bytestring
  
      Returns the message as bytestring.