'We just received a PDU'

def on_receive_pdu(self, pdu):

    pdu_type = pdu.pdu_type
    if (pdu_type == 'sy.room.message'):
        self._on_message(pdu)
    elif ((pdu_type == 'sy.room.member') and ('membership' in pdu.content)):
        if (pdu.content['membership'] == 'join'):
            self._on_join(pdu.context, pdu.state_key)
        elif (pdu.content['membership'] == 'invite'):
            self._on_invite(pdu.origin, pdu.context, pdu.state_key)
    else:
        self.output.print_line(('#%s    (unrec)    %s    =    %s' % (pdu.context, pdu.pdu_type, json.dumps(pdu.content))))
