Be more Pythonic and Python 3.x compatible

I've made the code respect more Python PEPs , this required:
- formatting changes (the number of spaces before methods, classes, indentation should be a multiple of 4, added docstrings to their proper place, etc)
- removed redundant parantheses
- simplified if conditionals
- removed unused imports

Made the code Python 3.x compatible by using the try except construct supported in both Python 2.x and 3.x

Still not fully compliant (function names should be lowercase, variable in function should be lowercase) but in my opinion, now, the code is more readable.