<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _do_config_packet(self, packet, ip, port):
 """ Apply config to this instance :param packet: Packet with config :type packet: paps.si.app.message.APPMessage :param ip: Ip of server :type ip: str :param port: Port of server :type port: int :rtype: None """

        self.debug("()")
        if packet.header.device_id != Id.SERVER:
            # Only allow config packets from server
            self.warning("Config packets only allowed from server")
            return

        try:
            config = packet.payload
            self.debug(u"{}".format(config))

            if not isinstance(config, dict):
                self.error("Wrong payload type")
                raise RuntimeError("Wrong type")
            config.setdefault("server_ip", ip)
            config.setdefault("server_port", port)
            self.config(config)
            self._joined.set()
        except:
            self.exception("Failed to configure")
            self.error(u"Faulty packet {}".format(format_data(packet.payload)))
            return