Python 3 uses new style classes as default.
Removed unused variable
Converted to a oneliner
Use a context manager instead
Reworked imports