Removed unused code: invert_range for ports
PEP8 fixes

Many fixes according to our style guidelines.
Include PEP8 compliance verification in test suite

From now on, PEP8 violations (slightly adjusted according to our coding
guidelines) count as test fails.