Add python 3.1 compatibility