Make assertion on pk type compatible with Python 3