def receive_response(self, response):
        """

        :type response: Response
        :param response:
        :rtype : Transaction
        """
        logger.debug("receive_response - " + str(response))
        try:
            host, port = response.source
        except __HOLE__:
            return
        key_mid = hash(str(host) + str(port) + str(response.mid))
        key_mid_multicast = hash(str(defines.ALL_COAP_NODES) + str(port) + str(response.mid))
        key_token = hash(str(host) + str(port) + str(response.token))
        key_token_multicast = hash(str(defines.ALL_COAP_NODES) + str(port) + str(response.token))
        if key_mid in self._transactions.keys():
            transaction = self._transactions[key_mid]
        elif key_token in self._transactions_token:
            transaction = self._transactions_token[key_token]
        elif key_mid_multicast in self._transactions.keys():
            transaction = self._transactions[key_mid_multicast]
        elif key_token_multicast in self._transactions_token:
            transaction = self._transactions_token[key_token_multicast]
        else:
            logger.warning("Un-Matched incoming response message " + str(host) + ":" + str(port))
            return None, False
        send_ack = False
        if response.type == defines.Types["CON"]:
            send_ack = True

        transaction.request.acknowledged = True
        transaction.completed = True
        transaction.response = response
        if transaction.retransmit_stop is not None:
            transaction.retransmit_stop.set()
        return transaction, send_ack
dataset/ETHPy150Open Tanganelli/CoAPthon/coapthon/layers/messagelayer.py/MessageLayer.receive_response