'Get currently enabled plugins.
:param string phase:
Optional, limits to plugins currently configured on given phase, sorted in phase order.
:return:
An iterator over configured :class:`flexget.plugin.PluginInfo` instances enabled on this task.'

def plugins(self, phase=None):

    if phase:
        plugins = sorted(get_plugins(phase=phase), key=(lambda p: p.phase_handlers[phase]), reverse=True)
    else:
        plugins = iter(all_plugins.values())
    return (p for p in plugins if ((p.name in self.config) or p.builtin))
