def _validate_string(value, valid_values, default):
    """Validate a string value parsed from the config file.
    @type  value: str
    @param value: Raw value read from config.
    @type  valid_values: list
    @param valid_values: Allowed values.
    @type  default: str
    @param default: Default value to use if the input value isn't valid.
    @rtype:  str
    @return: Value to use.
    """
    if value:
        value = value.lower()
        if value in valid_values:
            return value
    return default