'Execute given plugins phase method, with supplied args and kwargs.
If plugin throws unexpected exceptions :meth:`abort` will be called.
:param PluginInfo plugin: Plugin to be executed
:param string phase: Name of the phase to be executed
:param args: Passed to the plugin
:param kwargs: Passed to the plugin'

def __run_plugin(self, plugin, phase, args=None, kwargs=None):

    keyword = plugin.name
    method = plugin.phase_handlers[phase]
    if (args is None):
        args = []
    if (kwargs is None):
        kwargs = {}
    try:
        return method(*args, **kwargs)
    except TaskAbort:
        raise
    except PluginWarning as warn:
        if warn.kwargs.get(u'log_once', False):
            from flexget.utils.log import log_once
            log_once(warn.value, warn.log)
        else:
            warn.log.warning(warn)
    except EntryUnicodeError as eue:
        msg = (u'Plugin    %s    tried    to    create    non-unicode    compatible    entry    (key:    %s,    value:    %r)' % (keyword, eue.key, eue.value))
        log.critical(msg)
        self.abort(msg)
    except PluginError as err:
        err.log.critical(err.value)
        self.abort(err.value)
    except DependencyError as e:
        msg = (u'Plugin    `%s`    cannot    be    used    because    dependency    `%s`    is    missing.' % (keyword, e.missing))
        log.critical(msg)
        log.debug(e.message)
        self.abort(msg)
    except Warning as e:
        msg = (u'Warning    during    plugin    %s:    %s' % (keyword, e))
        log.exception(msg)
        self.abort(msg)
    except Exception as e:
        msg = (u'BUG:    Unhandled    error    in    plugin    %s:    %s' % (keyword, e))
        log.critical(msg)
        traceback = self.manager.crash_report()
        self.abort(msg, traceback=traceback)
