Fix commit 168a087 for Python 3
Fix commit 168a087 for Python 3

Simplify the type check and use the already existing one. Fix the string check
to work with both Python 2 and 3.

thiblahute/pygobject,thiblahute/pygobject,pexip/pygobject,thiblahute/pygobject,MathieuDuponchelle/pygobject,davibe/pygobject,jdahlin/pygobject,davidmalcolm/pygobject,jdahlin/pygobject,choeger/pygobject-cmake,choeger/pygobject-cmake,jdahlin/pygobject,sfeltman/pygobject,davidmalcolm/pygobject,MathieuDuponchelle/pygobject,davibe/pygobject,davibe/pygobject,davidmalcolm/pygobject,pexip/pygobject,sfeltman/pygobject,GNOME/pygobject,GNOME/pygobject,GNOME/pygobject,MathieuDuponchelle/pygobject,sfeltman/pygobject,davibe/pygobject,pexip/pygobject,choeger/pygobject-cmake