Added python 2.6+ compatibility

I made a few changes so that the code runs and the tests pass on python 2.6+. I've tested on python 2.6, 2.7, 3.2.

Most notably, an explicit __ne__ (!=) method was required for IntegerModP and Polynomial and the factory lambda on Polynomial had to be changed to a class method.