human
I wrote the below code

    def decorator(func):
        @functools.wraps(func)
        def wrapper(request, *args, **kw):
            if request.user.is_authenticated():
                return func(request, *args, **kw)
            elif redirect:
                return redirect_for_login(request)
            else:
                return http.HttpResponse(status=401)
        return wrapper
    if f:
        return decorator(f)
    else:
        return decorator

What's a good function header?
assistant
#Here's a good function header.

def login_required(f=None, redirect=True):