use isinstance, not obj.__type__