code: def login_required(func, permission=None):
      
      @wraps(func)
      def decorated_function(*args, **kwargs):
          if not check_token():
              return login()
          elif not nago.core.has_access(session.get('token')):
              return http403()
          return func(*args, **kwargs)
      return decorated_function
docs: decorate with this function in order to require a valid token for any view
  
       If no token is present you will be sent to a login page