'Creates an instance of the given plugin type, loading the plugin first if necessary.'

def _create_plugin_instance(self, type_, alias, constructor_kwargs):

    (plugin_container, class_container, base_class) = {'trigger': (self._trigger_plugins, self._trigger_classes, BaseTrigger), 'jobstore': (self._jobstore_plugins, self._jobstore_classes, BaseJobStore), 'executor': (self._executor_plugins, self._executor_classes, BaseExecutor)}[type_]
    try:
        plugin_cls = class_container[alias]
    except KeyError:
        if (alias in plugin_container):
            plugin_cls = class_container[alias] = plugin_container[alias].load()
            if (not issubclass(plugin_cls, base_class)):
                raise TypeError('The    {0}    entry    point    does    not    point    to    a    {0}    class'.format(type_))
        else:
            raise LookupError('No    {0}    by    the    name    "{1}"    was    found'.format(type_, alias))
    return plugin_cls(**constructor_kwargs)
