'Provide a result value processing function for the given
:class:`.Dialect`.
This is the method that fulfills the :class:`.TypeEngine`
contract for result value conversion.   :class:`.TypeDecorator`
will wrap a user-defined implementation of
:meth:`process_result_value` here.
User-defined code can override this method directly,
though its likely best to use :meth:`process_result_value` so that
the processing provided by ``self.impl`` is maintained.
:param dialect: Dialect instance in use.
:param coltype: An SQLAlchemy data type
This method is the reverse counterpart to the
:meth:`bind_processor` method of this class.'

def result_processor(self, dialect, coltype):

    if self._has_result_processor:
        process_value = self.process_result_value
        impl_processor = self.impl.result_processor(dialect, coltype)
        if impl_processor:
            def process(value):
                return process_value(impl_processor(value), dialect)
        else:
            def process(value):
                return process_value(value, dialect)
        return process
    else:
        return self.impl.result_processor(dialect, coltype)
