def handle_message(self, msg, host):
response = None<EOL>if host in self.encrypted_hosts:<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: return response<EOL>if self.is_registered(msg_data["<STR_LIT>"], host[<NUM_LIT:0>]):<EOL><INDENT>logger.debug("<STR_LIT>" % msg_data["<STR_LIT>"])<EOL><DEDENT>else:<EOL><INDENT>logger.debug("<STR_LIT>"  % msg_data["<STR_LIT>"])<EOL><DEDENT>if "<STR_LIT>" in msg_data:<EOL><INDENT>if msg_data["<STR_LIT>"] == "<STR_LIT>":<EOL><INDENT>logger.debug("<STR_LIT>" % msg_data["<STR_LIT>"])<EOL>response = self.register(msg_data, host)<EOL><DEDENT>elif msg_data["<STR_LIT>"] == "<STR_LIT>":<EOL><INDENT>if not self.discoverable:<EOL><INDENT>return False<EOL><DEDENT>logger.debug("<STR_LIT>" % msg_data["<STR_LIT>"])<EOL>response = self.autodiscover(msg_data)<EOL><DEDENT>elif msg_data["<STR_LIT>"] == "<STR_LIT>":<EOL><INDENT>logger.debug("<STR_LIT>" % msg_data["<STR_LIT>"])<EOL>response = self.auth_server.verify_login(msg_data)<EOL>if response:<EOL><INDENT>self.registry[host]["<STR_LIT>"] = True<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if self.auth_server:<EOL><INDENT>if self.registry[host]["<STR_LIT>"]:<EOL><INDENT>response = self.handle_message_registered(msg_data, host)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>response = self.handle_message_registered(msg_data, host)<EOL><DEDENT><DEDENT><DEDENT>logger.debug("<STR_LIT>")<EOL>return response<EOL>
Processes messages that have been delivered from the listener.

        Args:
          msg (string): The raw packet data delivered from the listener. This
            data will be unserialized and then processed based on the packet's
            method.
          host (tuple): The (address, host) tuple of the source message.

        Returns:
          A response that will be sent back to the client via the listener.