py3k compatible detection