Wrap method return results.  The return value of the action
        method and of the action extensions is passed through this
        method before being returned to the caller.  Instances of
        `webob.Response` are thrown, to abort the rest of action and
        extension processing; otherwise, objects which are not
        instances of ResponseObject will be wrapped in one.

def wrap(self, req, result):
        """
        Wrap method return results.  The return value of the action
        method and of the action extensions is passed through this
        method before being returned to the caller.  Instances of
        `webob.Response` are thrown, to abort the rest of action and
        extension processing; otherwise, objects which are not
        instances of ResponseObject will be wrapped in one.
        """

        if isinstance(result, webob.exc.HTTPException):
            # It's a webob HTTP exception; use raise to bail out
            # immediately and pass it upstream
            raise result
        elif isinstance(result, webob.Response):
            # Straight-up webob Response object; we raise
            # AppathyResponse to bail out
            raise exceptions.AppathyResponse(result)
        elif isinstance(result, response.ResponseObject):
            # Already a ResponseObject; bind it to this descriptor
            result._bind(self)
            return result
        else:
            # Create a new, bound, ResponseObject
            return self.resp_type(req, result, _descriptor=self)