To return the results as a response from a Flask view you can pass the summary data to the jsonify function, which returns a JSON response.
This function turns the JSON output into a response object with the application/json mime type. For users convenience, it also converts multiple arguments into an array or multiple keyword arguments into a dictionary. So, it means that if we do jsonify(1,2,3) and jsonify([1,2,3]) both are serialize as [1,2,3]. For that, you will write the following piece of code.
from flask import jsonify
d = make_summary()
If you wish to learn more about Python, visit Python tutorial and Python course by Intellipaat.