Python 2 compatibility fix
On Python 2 we need to check for unicode instead of string but on Python 3 unicode is not defined. So we define it as str which gives cleaner if-statements
On Python 2 we need to check for unicode instead of string but on Python 3 unicode is not defined. So we define it as str which gives cleaner if-statements