docs: def as_view(url=None, methods=None, view_class=ActionsView, name=None, url_rules=None, **kwargs):
      """Decorator to transform a function into a view class. Be warned that this will replace
      the function with the view class.
      """
      def decorator(f):
          if url is not None:
              f = expose(url, methods=methods)(f)
  
          clsdict = {"name": name or f.__name__,
                     "actions": getattr(f, "actions", None),
                     "url_rules": url_rules or getattr(f, "urls", None)}
  
          if isinstance(f, WithActionsDecorator):
              f = f.func
          clsdict['func'] = f
  
          def constructor(self, **ctorkwargs):
              for k, v in kwargs.items():
                  if k not in ctorkwargs or ctorkwargs[k] is None:
                      ctorkwargs[k] = v
              view_class.__init__(self, func=f, **ctorkwargs)
  
          clsdict["__init__"] = constructor
          return type(f.__name__, (view_class,), clsdict)
  
      return decorator