def parse(self, stream):
        yaml = self._load_yaml()

        try:
            parsed_obj = yaml.safe_load(stream)
        except Exception as e:
            raise ConfigFileParserException("Couldn't parse config file: %s" % e)

        if type(parsed_obj) != dict:
            raise ConfigFileParserException("The config file doesn't appear to "
                "contain 'key: value' pairs (aka. a YAML mapping). "
                "yaml.load('%s') returned type '%s' instead of 'dict'." % (
                getattr(stream, 'name', 'stream'),  type(parsed_obj).__name__))

        result = OrderedDict()
        for key, value in parsed_obj.items():
            if type(value) == list:
                result[key] = value
            else:
                result[key] = str(value)

        return result
Parses the keys and values from a config file.
dataset/ETHPy150Open bw2/ConfigArgParse/configargparse.py/YAMLConfigFileParser.parse