def load(self, prefix=None, depth=None):
prefix = prefix or self.prefix<EOL>prefix = '<STR_LIT:/>' + prefix.strip('<STR_LIT:/>') + '<STR_LIT:/>'<EOL>if depth is None:<EOL><INDENT>depth = self.inherit_depth<EOL><DEDENT>if not self.configured:<EOL><INDENT>log.debug("<STR_LIT>")<EOL>return<EOL><DEDENT>if self.watching:<EOL><INDENT>log.info("<STR_LIT>", prefix)<EOL>self.start_watching()<EOL><DEDENT>log.info("<STR_LIT>", prefix)<EOL>try:<EOL><INDENT>result = self.client.get(prefix)<EOL><DEDENT>except self.module.EtcdKeyNotFound:<EOL><INDENT>result = None<EOL><DEDENT>if not result:<EOL><INDENT>log.info("<STR_LIT>")<EOL>return {}<EOL><DEDENT>update = {}<EOL>for item in result.children:<EOL><INDENT>key = item.key<EOL>value = item.value<EOL>try:<EOL><INDENT>value = pytool.json.from_json(value)<EOL><DEDENT>except:<EOL><INDENT>pass<EOL><DEDENT>if not self.case_sensitive:<EOL><INDENT>key = key.lower()<EOL><DEDENT>if key.startswith(prefix):<EOL><INDENT>key = key[len(prefix):]<EOL><DEDENT>update[key] = value<EOL><DEDENT>inherited = Config().settings.get(self.inherit_key,<EOL>update.get(self.inherit_key, None))<EOL>if depth > <NUM_LIT:0> and inherited:<EOL><INDENT>log.info("<STR_LIT>")<EOL>inherited = self.load(inherited, depth - <NUM_LIT:1>) or {}<EOL>inherited.update(update)<EOL>update = inherited<EOL><DEDENT>return update<EOL>
Return a dictionary of settings loaded from etcd.