def _load_group_file(self, fn): output = None unwanted = None with open(fn, 'r') as fh: self.logger.debug('reading %s', fn) for groupname, group in yaml.safe_load(fh).items(): if groupname == 'OUTPUT': output = group continue if groupname == 'UNWANTED': unwanted = set(group) continue g = Group(groupname, self) g.parse_yml(group) return output, unwanted