def create_instance(self, name, moduleName, settings):
if name in self.insts:<EOL><INDENT>raise ValueError("<STR_LIT>" %<EOL>name)<EOL><DEDENT>if moduleName not in self.modules:<EOL><INDENT>raise ValueError("<STR_LIT>" % moduleName)<EOL><DEDENT>md = self.modules[moduleName]<EOL>deps = dict()<EOL>for k, v in six.iteritems(md.deps):<EOL><INDENT>if k not in settings:<EOL><INDENT>settings[k] = self._get_or_create_a(v.type)<EOL><DEDENT>if settings[k] is None:<EOL><INDENT>if not v.allow_null:<EOL><INDENT>raise ValueError("<STR_LIT>" % k)<EOL><DEDENT><DEDENT>elif settings[k] not in self.insts:<EOL><INDENT>raise ValueError("<STR_LIT>" % settings[k])<EOL><DEDENT>else:<EOL><INDENT>settings[k] = self.insts[settings[k]].object<EOL>deps[k] = settings[k]<EOL><DEDENT><DEDENT>for k, v in six.iteritems(md.vsettings):<EOL><INDENT>if k not in settings:<EOL><INDENT>settings[k] = v.default<EOL>if v.default is None:<EOL><INDENT>self.l.warn('<STR_LIT>' % (name, k))<EOL><DEDENT><DEDENT><DEDENT>self.l.info('<STR_LIT>' % (name, md.implementedBy))<EOL>cl = get_by_path(md.implementedBy)<EOL>il = logging.getLogger(name)<EOL>obj = cl(settings, il)<EOL>self.register_instance(name, moduleName, obj, settings, deps)<EOL>return obj<EOL>
Creates an instance of <moduleName> at <name> with
            <settings>.