added `elif not isinstance(version, basestring):` clause (shouldn't happen though)