Fix Python 3.2; refactor function.__code__ access

It turns out the new import library stuff was not around in 3.2 yet.