def get_param_by_name(self, db, name):
        key_comparator = lambda param: \
                name == param.get_option(self.OPT_KEY, 'key', None)
        name_comparator = lambda param: name == param.name
        by_key = list(filter(key_comparator, db.parameters))
        if len(by_key) > 1:
            raise ValueError('More than one parameters are set with name {}'.format(name))
        elif len(by_key) == 1:
            return by_key[0]

        by_name = list(filter(name_comparator, db.parameters))
        if len(by_name) > 1:
            raise ValueError('More than one parameters are set with key {}'.format(name))
        elif len(by_name) == 1:
            return by_name[0]
        else:
            return None
dataset/ETHPy150Open genzj/pybingwallpaper/src/config.py/ConfigFileDumper.get_param_by_name/original