Apply PEP8, fixes docstrings and remove unused imports