code: def login_required(method):
      
      def wrapper(self, *arg, **karg):
          if not self.user:
              if self.request.method == "GET":
                  self.redirect(settings.LOGIN_PATH)
              else:
                  self.error(403)
          else:
              method(self, *arg, **karg)
      return wrapper
docs: A decorator that control if a user is logged.