def checktype(self, val, kind, **kargs):
        """Raise TypeError if val does not satisfy kind."""
        if not isinstance(val, kind):
            raise TypeError('Expected {}; got {}'.format(
                            self.str_kind(kind), self.str_valtype(val)))
Raise TypeError if val does not satisfy kind.