<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def login_required(request):
    "Lookup decorator to require the user to be authenticated."
    user = getattr(request, 'user', None)
    if user is None or not user.is_authenticated:
        return HttpResponse(status=401)