docs: def decorator(decor):
      """Decorator for decorators (sic), written either as classes or functions.
  
      In either case, the decorator ``decor`` must be "doubly-callable":
  
          * for classes, this means implementing ``__call__`` method
            in addition to possible ``__init__``
          * for functions, this means returning a function that acts
            as an actual decorator, i.e. taking a function and returning
            its decorated version
  
      Although it works for any decorator, it's useful mainly for those
      that should take optional arguments. If the decorator is adorned
      with ``@decorator``, it's possible to use it without the pair of
      empty parentheses::
  
          @enhanced  # rather than @enhanced()
          def foo():
              pass
  
      when we don't want to pass any arguments to it.
  
      .. note::
  
          :func:`decorator` makes decorator appicable for both
          functions and classes. If you want to restrict the type of
          decorator targets, use :func:`function_decorator`,
          :func:`method_decorator` or :func:`class_decorator`.
      """
      ensure_callable(decor)
      return _wrap_decorator(decor, "functions or classes",
                             or_(inspect.isfunction, inspect.isclass))