Format the python codes according to `pep8` conventions. Change comments to docstrings wherever required, etc.