'not __ in __' changed to '__ not in __' to reduce noise from pep8 test
use print function in doctests
handle urllib2 in python 3
fix doctest

dictionary keys are not guaranteed to be sorted, so sort them before comparing