Handle types in a Python 3 friendly way