code: def _handle_response(self, transaction):
          
          code = transaction.response.code
          utils.check_code(code)
          """
          VALID response:
          change the current cache value by switching the option set with the one provided
          also resets the timestamp
          if the request etag is different from the response, send the cached response
          """
          if code == Codes.VALID.number:
              logger.debug("received VALID")
              self.cache.validate(transaction.request, transaction.response)
              if transaction.request.etag != transaction.response.etag:
                  element = self.cache.search_response(transaction.request)
                  transaction.response = element.cached_response
              return transaction
  
          """
          CHANGED, CREATED or DELETED response:
          mark the requested resource as not fresh
          """
          if code == Codes.CHANGED.number or code == Codes.CREATED.number or code == Codes.DELETED.number:
              target = self.cache.search_related(transaction.request)
              if target is not None:
                  for element in target:
                      self.cache.mark(element)
              return transaction
  
          """
          any other response code can be cached normally
          """
          self.cache.cache_add(transaction.request, transaction.response)
          return transaction
docs: handles responses based on their type
  
          :param transaction:
          :return: