'Create or load an Application based on the parameters found in the
given L{ServerOptions} instance.
If a subcommand was used, the L{service.IServiceMaker} that it
represents will be used to construct a service to be added to
a newly-created Application.
Otherwise, an application will be loaded based on parameters in
the config.'

def createOrGetApplication(self):

    if self.config.subCommand:
        plg = self.config.loadedPlugins[self.config.subCommand]
        ser = plg.makeService(self.config.subOptions)
        application = service.Application(plg.tapname)
        ser.setServiceParent(application)
    else:
        passphrase = getPassphrase(self.config['encrypted'])
        application = getApplication(self.config, passphrase)
    return application
