python 3.2 adaption. THX Oliver