static getInstance(ui, system, extension) {
        const pkg = extension.pkg;
        const dir = extension.dir;

        // TODO: currently this returns an instance of the base class only if
        // the pkg.main doesn't exist. If any errors are generated by these checks here,
        // nothing is returned. We should probably either throw an error here or return
        // an instance of the base class
        if (pkg.main) {
            if (!fs.existsSync(path.join(dir, pkg.main))) {
                ui.log(`Extension '${pkg.name}' has a main entry, but no such file exists`, 'yellow');
                return;
            }

            const ExtensionSubclass = require(path.join(dir, path.basename(pkg.main, '.js')));

            if (!ExtensionSubclass || !(ExtensionSubclass.prototype instanceof Extension)) {
                ui.log(`Extension '${pkg.name}' supplied a main file, but it is not a valid Extension subclass`, 'yellow');
                return;
            }

            return new ExtensionSubclass(ui, system, pkg, dir);
        }

        return new this(ui, system, pkg, dir);
    }
Gets the Extension instance for a given extension. An extension can
extend this class and override some of it's features. If no such subclass exists
an instance of the base class (this one) will be returned

@param {UI} ui UI instance
@param {System} system System instance
@param {Object} extension Object (returned from find-plugins) containing the
                package.json contents and the dir of the extension
@return Extension
@static
@method getInstance
@private