def update_resource(self, transaction):
        """
        Render a PUT request.

        :param request: the request
        :param response: the response
        :param resource: the resource
        :return: the response
        """
        # If-Match
        if transaction.request.if_match:
            if None not in transaction.request.if_match and str(transaction.resource.etag) \
                    not in transaction.request.if_match:
                transaction.response.code = defines.Codes.PRECONDITION_FAILED.number
                return transaction
        # If-None-Match
        if transaction.request.if_none_match:
            transaction.response.code = defines.Codes.PRECONDITION_FAILED.number
            return transaction

        method = getattr(transaction.resource, "render_PUT", None)

        try:
            resource = method(request=transaction.request)
        except __HOLE__:
            transaction.response.code = defines.Codes.METHOD_NOT_ALLOWED.number
            return transaction

        if isinstance(resource, Resource):
            pass
        elif isinstance(resource, tuple) and len(resource) == 2:
            resource, callback = resource
            resource = self._handle_separate(transaction, callback)
            if not isinstance(resource, Resource):  # pragma: no cover
                transaction.response.code = defines.Codes.INTERNAL_SERVER_ERROR.number
                return transaction
        else:  # pragma: no cover
            # Handle error
            transaction.response.code = defines.Codes.INTERNAL_SERVER_ERROR.number
            return transaction

        if resource.etag is not None:
            transaction.response.etag = resource.etag

        transaction.response.code = defines.Codes.CHANGED.number
        transaction.response.payload = None
        resource.changed = True
        resource.observe_count += 1
        transaction.resource = resource

        return transaction
dataset/ETHPy150Open Tanganelli/CoAPthon/coapthon/layers/resourcelayer.py/ResourceLayer.update_resource