code: def get_enabled_plugins():
      '''
      Returns enabled preview plugins.
      Plugins are sorted, defaults come last
      '''
      plugins = entrypoints.get_enabled('udata.preview', current_app).values()
      valid = [p for p in plugins if issubclass(p, PreviewPlugin)]
      for plugin in plugins:
          if plugin not in valid:
              clsname = plugin.__name__
              msg = '{0} is not a valid preview plugin'.format(clsname)
              warnings.warn(msg, PreviewWarning)
      return [p() for p in sorted(valid, key=lambda p: 1 if p.fallback else 0)]