Extract type-checking to support `namedtuple`.

Dunno whether it is a wide solution to support namedtuple :(
I don't think these are really necessary - they're not saving you that much typing and add a layer of indirection.