Bunch of small fixes

This pull request contains a bunch of fixes for issues found with pylint:
- add missing space around operator
- fix bad indention
- remove unused imports
- add missing imports
- rename function parameters to prevent redefining names from outer scope
- rename log to LOG since constants should be named upper case
- fix subprocess handling and raising error
- add/fix some docstrings
- remove local get_file() use misc.get_file() instead