understood some parts of api.py
Finally understood the sorted function in api.py