def from_raw_message(cls, rawmessage):
        """Create a message from a raw byte stream."""
        if (rawmessage[5] &
                MESSAGE_FLAG_EXTENDED_0X10) == MESSAGE_FLAG_EXTENDED_0X10:
            if len(rawmessage) >= ExtendedSend.receivedSize:
                msg = ExtendedSend.from_raw_message(rawmessage)
            else:
                msg = None
        else:
            msg = StandardSend(rawmessage[2:5],
                               {'cmd1': rawmessage[6],
                                'cmd2': rawmessage[7]},
                               flags=rawmessage[5],
                               acknak=rawmessage[8:9])
        return msg
def from_raw_message ( cls , rawmessage ) : if ( rawmessage [ 5 ] & MESSAGE_FLAG_EXTENDED_0X10 ) == MESSAGE_FLAG_EXTENDED_0X10 : if len ( rawmessage ) >= ExtendedSend . receivedSize : msg = ExtendedSend . from_raw_message ( rawmessage ) else : msg = None else : msg = StandardSend ( rawmessage [ 2 : 5 ] , { 'cmd1' : rawmessage [ 6 ] , 'cmd2' : rawmessage [ 7 ] } , flags = rawmessage [ 5 ] , acknak = rawmessage [ 8 : 9 ] ) return msg
Create a message from a raw byte stream.