Add python2.6 compatibility

This change mainly involves an alternative import of OrderedDict, modified dict and set comprehensions, and using unittest2 for testing. 
This indeed was a bug (also one place where didn't have good test coverage).