def return_value_or_default(self, name, value):
        if name not in self.options:
            raise KeyError("%s is not a valid option" % name)

        # Separate the type and default from the tuple
        type_check, default = self.options[name]

        # Return the default if the value passed in was wrong, otherwise return
        # the value passed in
        if not isinstance(value, type_check):
            if value is not None:
                self.logger.warning(
                    "Value passed in for option %s was invalid -- ignoring" %
                    name
                )
            else:
                self.logger.debug(
                    "No value set for option %s -- using default" % name)

            return default
        else:
            return value
Convert data to target value
dataset/ETHPy150Open JohnMaguire/Cardinal/cardinal/config.py/ConfigSpec.return_value_or_default--crossover with--dataset/ETHPy150Open geopython/pywps/pywps/inout/literaltypes.py/convert