Updated to support Python3.