app=Flask(__name__)app.config.from_object(FlaskPlaygroundConfig)jwt=JWTManager(app)# Register a callback function that takes whatever object is passed in as the# identity when creating JWTs and converts it to a JSON serializable format.@jwt.user_identity_loaderdefuser_identity_lookup(user):returnstr(user.id)# Register a callback function that loads a user from your database whenever# a protected route is accessed. This should return any python object on a# successful lookup, or None if the lookup failed for any reason (for example# if the user has been deleted from the database).@jwt.user_lookup_loaderdefuser_lookup_callback(_jwt_header,jwt_data):identity=jwt_data["sub"]returnUserEntity.query.filter_by(id=identity,is_deleted=False).one_or_none()