import plugins

def getConverter(data, mime_type=None, filename=None):
    plugin = plugins.selectPlugin(data, mime_type=mime_type,
                                  filename=filename)
    
    if plugin != plugins.Dumb:
        try:
            result = plugin.getConverter(data)
        except plugins.ConversionError:
            plugin = plugins.getDefaultPlugin()
            result = plugin.getConverter(data)
    else:
        result = plugin.getConverter(data)
    return result
