def quote_val(value):
    """Double quote a string value, if it's a string"""
    quote_char = '"'
    if isinstance(value, str):
        # Is it already quoted?
        if len(value) >= 2:
            if value[0] == quote_char and value[-1] == quote_char:
                # Yes, already quoted
                return value
        # Nope, quote it
        return quote_char + value + quote_char

    return value