def send_response(self, 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 AttributeError:
                return
            key_mid = hash(str(host) + str(port) + str(transaction.response.mid))
            self._transactions[key_mid] = transaction

        transaction.request.acknowledged = True
        return transaction
Decorator to log uncaught exceptions and prevent them from
dataset/ETHPy150Open Tanganelli/CoAPthon/coapthon/layers/messagelayer.py/MessageLayer.send_response--crossover with--dataset/ETHPy150Open dimagi/commcare-hq/corehq/util/decorators.py/handle_uncaught_exceptions