Import ckan.lib.datapreview that's used in the plugin

As per the plugin guidelines, we should avoid importing CKAN stuff directly, to
avoid coupling too much to its internals. We might want to remove this in the
future if possible.