fix python2 comparisons by explicitly raising `TypeError`

Python2's weird comparison semantics are inconsistent with what
we expect when `NotImplemented` is returned.
2 jobs for bugfix/comparison