code: def login_required(function=None, message=None, login_url=None):
      
      actual_decorator = user_passes_test(
          lambda u: u.is_authenticated(),
          message=message,
          login_url=login_url
      )
  
      if function:
          return actual_decorator(function)
      return actual_decorator
docs: Decorator for views that checks that the user is logged in, redirecting
      to the log-in page if necessary.