'Loads given plugin'

def load(self, name):

    logging.debug(('Loading    plugin    %s' % name))
    try:
        try:
            mod = imp.load_module(('ajenti.plugins.%s' % name), *imp.find_module(name, [self.get_plugins_root(), self.extra_location]))
            if (not hasattr(mod, 'info')):
                raise PluginFormatError()
        except PluginFormatError:
            raise
        except Exception as e:
            from ajenti.api import PluginInfo
            info = PluginInfo(name=name, crash=e)
            self.__plugins[name] = info
            raise PluginCrashed(e)
        info = mod.info
        info.module = mod
        info.active = False
        info.name = name
        info.path = mod.__path__[0]
        info.crash = None
        if hasattr(mod, 'init'):
            info.init = mod.init
        self.__plugins[name] = info
        for dependency in info.dependencies:
            dependency.check()
        info.active = True
        try:
            info.init()
        except Exception as e:
            raise PluginCrashed(e)
        if (name in self.__order):
            self.__order.remove(name)
        self.__order.append(name)
        return True
    except PluginDependency.Unsatisfied as e:
        raise
    except PluginFormatError as e:
        logging.warn(('    ***    [%s]    Plugin    error:    %s' % (name, e)))
    except PluginCrashed as e:
        logging.warn(('    ***    [%s]    Plugin    crashed:    %s' % (name, e)))
        print e.traceback
        info.crash = e
    except Dependency.Unsatisfied as e:
        logging.debug(('    ***    [%s]    skipping    due    to    %s' % (name, e)))
        info.crash = e
    except PluginLoadError as e:
        logging.warn(('    ***    [%s]    Plugin    failed    to    load:    %s' % (name, e)))
        info.crash = e
