Some coding style fixes
Finished python's lib/api.py