check this like this:

not isinstance(ttype, theano.gof.Type)