Add py3k support for thread module