Make oshift Python 3 ready

This pull request makes oshift work with Python 3 (+does some Python beutification).