docs: def as_view(cls, view_type, *init_args, **init_kwargs):
          """
          Used for hooking up the all endpoints (including custom ones), this
          returns a wrapper function that creates a new instance of the resource
          class & calls the correct view method for it.
  
          :param view_type: Should be one of ``list``, ``detail`` or ``custom``.
          :type view_type: string
  
          :param init_args: (Optional) Positional params to be persisted along
              for instantiating the class itself.
  
          :param init_kwargs: (Optional) Keyword params to be persisted along
              for instantiating the class itself.
  
          :returns: View function
          """
          @wraps(cls)
          def _wrapper(request, *args, **kwargs):
              # Make a new instance so that no state potentially leaks between
              # instances.
              inst = cls(*init_args, **init_kwargs)
              inst.request = request
              return inst.handle(view_type, *args, **kwargs)
  
          return _wrapper