Add python2.6 compatibility

This change mainly involves an alternative import of OrderedDict, modified dict and set comprehensions, and using unittest2 for testing. 
Understood and fixed.