<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def sp_msg(cmd, pipe=None, data=None):
 """Produces skypipe protocol multipart message"""

    msg = [SP_HEADER, cmd]
    if pipe is not None:
        msg.append(pipe)
    if data is not None:
        msg.append(data)
    return msg