def encode(self):
header    = bytearray(<NUM_LIT:1>)<EOL>payload   = bytearray()<EOL>varHeader = encode16Int(self.msgId)<EOL>header[<NUM_LIT:0>] = <NUM_LIT>    <EOL>for topic in self.topics:<EOL><INDENT>payload.extend(encodeString(topic)) <EOL><DEDENT>header.extend(encodeLength(len(varHeader) + len(payload)))<EOL>header.extend(varHeader)<EOL>header.extend(payload)<EOL>self.encoded = header<EOL>return str(header) if PY2 else bytes(header)<EOL>
Encode and store an UNSUBCRIBE control packet
@raise e: C{ValueError} if any encoded topic string exceeds 65535 bytes