'Return a dialect-specific :class:`.TypeEngine` instance
for this :class:`.TypeDecorator`.
In most cases this returns a dialect-adapted form of
the :class:`.TypeEngine` type represented by ``self.impl``.
Makes usage of :meth:`dialect_impl` but also traverses
into wrapped :class:`.TypeDecorator` instances.
Behavior can be customized here by overriding
:meth:`load_dialect_impl`.'

def type_engine(self, dialect):

    adapted = dialect.type_descriptor(self)
    if (type(adapted) is not type(self)):
        return adapted
    elif isinstance(self.impl, TypeDecorator):
        return self.impl.type_engine(dialect)
    else:
        return self.load_dialect_impl(dialect)
