code: def receive_response(self, response):
          
          logger.debug("receive_response - " + str(response))
          try:
              host, port = response.source
          except AttributeError:
              return
          key_mid = str_append_hash(host, port, response.mid)
          key_mid_multicast = str_append_hash(defines.ALL_COAP_NODES, port, response.mid)
          key_token = str_append_hash(host, port, response.token)
          key_token_multicast = str_append_hash(defines.ALL_COAP_NODES, port, response.token)
          if key_mid in list(self._transactions.keys()):
              transaction = self._transactions[key_mid]
              if response.token != transaction.request.token:
                  logger.warning("Tokens does not match -  response message " + str(host) + ":" + str(port))
                  return None, False
          elif key_token in self._transactions_token:
              transaction = self._transactions_token[key_token]
          elif key_mid_multicast in list(self._transactions.keys()):
              transaction = self._transactions[key_mid_multicast]
          elif key_token_multicast in self._transactions_token:
              transaction = self._transactions_token[key_token_multicast]
              if response.token != transaction.request.token:
                  logger.warning("Tokens does not match -  response message " + str(host) + ":" + str(port))
                  return None, False
          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
docs: Pair responses with requests.
  
          :type response: Response
          :param response: the received response
          :rtype : Transaction
          :return: the transaction to which the response belongs to