code: def wrap_handler(cls, handler, protocol, **kwargs):
          ''' Wrap a request handler with the matching protocol handler '''
          def _wrapper(request, *args, **kwargs):
              instance = cls(request=request, **kwargs)
              if protocol == Resource.Protocol.http:
                  return instance._wrap_http(handler, request=request, **kwargs)
              elif protocol == Resource.Protocol.websocket:
                  return instance._wrap_ws(handler, request=request, **kwargs)
              elif protocol == Resource.Protocol.amqp:
                  return instance._wrap_amqp(view_type, *args, **kwargs)
              else:
                  raise Exception('Communication protocol not specified')
          return _wrappef wrap_handler(cls, handler, protocol, **kwargs):
          ''' Wrap a request handler with the matching protocol handler '''
          def _wrapper(request, *args, **kwargs):
              instance = cls(request=request, **kwargs)
              if protocol == Resource.Protocol.http:
                  return instance._wrap_http(handler, request=request, **kwargs)
              elif protocol == Resource.Protocol.websocket:
                  return instance._wrap_ws(handler, request=request, **kwargs)
              elif protocol == Resource.Protocol.amqp:
                  return instance._wrap_amqp(view_type, *args, **kwargs)
              else:
                  raise Exception('Communication protocol not specified')
          return _wrapper
docs: Wrap a request handler with the matching protocol handler