code: def handle_packet(self, packet):
          
          if self.packet_callback:
              # forward to callback
              self.packet_callback(packet)
          else:
              print('packet', packet)
docs: Process incoming packet dict and optionally call callback.