Make code more pythonic (9)

- sort imports
- use python calls whenever possible
- use string formatter newer syntax