def mad_quote(value):
    """Add quotes to a string value."""
    if '"' not in value:
        return '"' + value + '"'
    if "'" not in value:
        return "'" + value + "'"
    raise ValueError('MAD-X unable to parse string with escaped quotes: {!r}'
        .format(value))
