def send_response(self, transaction):
        """

        :type transaction: Transaction
        :param transaction:
        """
        logger.debug("send_response - " + str(transaction.response))
        if transaction.response.type is None:
            if transaction.request.type == defines.Types["CON"] and not transaction.request.acknowledged:
                transaction.response.type = defines.Types["ACK"]
                transaction.response.mid = transaction.request.mid
                transaction.response.acknowledged = True
                transaction.completed = True
            elif transaction.request.type == defines.Types["NON"]:
                transaction.response.type = defines.Types["NON"]
            else:
                transaction.response.type = defines.Types["CON"]

        if transaction.response.mid is None:
            transaction.response.mid = self._current_mid
            self._current_mid += 1 % 65535
            try:
                host, port = transaction.response.destination
            except __HOLE__:
                return
            key_mid = hash(str(host) + str(port) + str(transaction.response.mid))
            self._transactions[key_mid] = transaction

        transaction.request.acknowledged = True
        return transaction
dataset/ETHPy150Open Tanganelli/CoAPthon/coapthon/layers/messagelayer.py/MessageLayer.send_response