'Cast any value in the config to the right type or use the default'

def check_setting(self, key):

    (key, definition_type, section, ini_key, default) = self._define(key)
    self.check_section(section)
    try:
        my_val = definition_type(self._config[section][ini_key])
    except Exception:
        my_val = definition_type(default)
        self._config[section][ini_key] = my_val
    return my_val
