Adapt to python 2.