def handle_message(self, msg, host):
logger.debug("<STR_LIT>")<EOL>response = None<EOL>if self.encryption and self.server_key:<EOL><INDENT>msg_data = unserialize_data(msg, self.compression, self.encryption)<EOL><DEDENT>else:<EOL><INDENT>msg_data = unserialize_data(msg, self.compression)<EOL><DEDENT>logger.debug("<STR_LIT>" + pformat(msg_data))<EOL>if not msg_data:<EOL><INDENT>return response<EOL><DEDENT>if "<STR_LIT>" in msg_data:<EOL><INDENT>if msg_data["<STR_LIT>"] == "<STR_LIT>":<EOL><INDENT>logger.debug("<STR_LIT>"<EOL>"<STR_LIT>" % (self.cuuid, host[<NUM_LIT:0>]))<EOL>self.discovered_servers[host]= [msg_data["<STR_LIT:version>"], msg_data["<STR_LIT>"]]<EOL>if self.autoregistering:<EOL><INDENT>self.register(host)<EOL>self.autoregistering = False<EOL><DEDENT><DEDENT>elif msg_data["<STR_LIT>"] == "<STR_LIT>":<EOL><INDENT>self.event_notifies[msg_data["<STR_LIT>"]] = msg_data["<STR_LIT>"]<EOL>logger.debug("<STR_LIT>" % self.cuuid)<EOL>logger.debug("<STR_LIT>" % (self.cuuid,<EOL>pformat(self.event_notifies)))<EOL>response = serialize_data(<EOL>{"<STR_LIT>": str(self.cuuid),<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": msg_data["<STR_LIT>"]},<EOL>self.compression, self.encryption, self.server_key)<EOL><DEDENT>elif msg_data["<STR_LIT>"] == "<STR_LIT>":<EOL><INDENT>logger.debug("<STR_LIT>" % self.cuuid)<EOL>self.registered = True<EOL>self.server = host<EOL>if "<STR_LIT>" in msg_data and self.encryption:<EOL><INDENT>self.server_key = PublicKey(<EOL>msg_data["<STR_LIT>"][<NUM_LIT:0>], msg_data["<STR_LIT>"][<NUM_LIT:1>])<EOL><DEDENT><DEDENT>elif (msg_data["<STR_LIT>"] == "<STR_LIT>" or<EOL>msg_data["<STR_LIT>"] == "<STR_LIT>"):<EOL><INDENT>logger.debug("<STR_LIT>" % str(self.cuuid))<EOL>self.legal_check(msg_data)<EOL>response = serialize_data(<EOL>{"<STR_LIT>": str(self.cuuid),<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": msg_data["<STR_LIT>"]},<EOL>self.compression, self.encryption, self.server_key)<EOL><DEDENT><DEDENT>logger.debug("<STR_LIT>")<EOL>return response<EOL>
Processes messages that have been delivered from the transport
        protocol

        Args:
          msg (string): The raw packet data delivered from the transport
            protocol.
          host (tuple): A tuple containing the (address, port) combination of
            the message's origin.

        Returns:
          A formatted response to the client with the results of the processed
          message.

        Examples:
          >>> msg
          {"method": "OHAI Client", "version": "1.0"}
          >>> host
          ('192.168.0.20', 36545)