Extract type-checking to support `namedtuple`.

Dunno whether it is a wide solution to support namedtuple :(
Given the above discussion on tuple subclassing, can you add a few test cases that ensure that the existing behavior still works with plain tuples and some other subclass of tuple that isn't a namedtuple (i.e. `class MyTuple(tuple): pass`)?