make this work with python2

hey, thanks much for this
here is a small patch to make it work with python2 (tested on ubuntu maverick / python 2.6)