Python 3 compatibility.

This is a pretty blind python 3 compatibility conversion that may well have completely missed the point of any or all of the code it touches. It does, however get all but one of the tests passing on python 3.3 and 2.7 (with django 1.6 pre-alpha, and 1.5 respectively).

I do not understand why `TestLayoutObjects.test_tab_helper_reuse` does not pass.