Flask TypeError: The view function did not return a valid response. The function either returned None or ended without a return statement [duplicate]

Solution
from flask import jsonify

if len(user) > 0:
    if bcrypt.hashpw(password, user['password'].encode('utf-8')) == user['password'].encode('utf-8'):
        session['name'] = user['name']
        session['email'] = user['email']
        return render_template("home.html")
    else:
        return jsonify({"message":"Error password or user not match"})
else:
    return jsonify({"message":"user not available"})