def decorator(deco):
    """
    Transforms a flat wrapper into decorator::

        @decorator
        def func(call, methods, content_type=DEFAULT):  # These are decorator params
            # Access call arg by name
            if call.request.method not in methods:
                # ...
            # Decorated functions and all the arguments are accesible as:
            print(call._func, call_args, call._kwargs)
            # Finally make a call:
            return call()
    """
    if has_single_arg(deco):
        return make_decorator(deco)
    elif has_1pos_and_kwonly(deco):
        # Any arguments after first become decorator arguments
        # And a decorator with arguments is essentially a decorator fab
        # TODO: use pos-only arg once in Python 3.8+ only
        def decorator_fab(_func=None, **dkwargs):
            if _func is not None:
                return make_decorator(deco, (), dkwargs)(_func)
            return make_decorator(deco, (), dkwargs)
    else:
        def decorator_fab(*dargs, **dkwargs):
            return make_decorator(deco, dargs, dkwargs)

    return wraps(deco)(decorator_fab)

    Transforms a flat wrapper into decorator::

        @decorator
        def func(call, methods, content_type=DEFAULT):  # These are decorator params
            # Access call arg by name
            if call.request.method not in methods:
                # ...
            # Decorated functions and all the arguments are accesible as:
            print(call._func, call_args, call._kwargs)
            # Finally make a call:
            return call()
    
funcy/decorators.py