<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def encode_ipmb_msg(header, data):
 """Encode an IPMB message. header: IPMB header object data: IPMI message data as bytestring Returns the message as bytestring. """

    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()