def _qfind(s, char):
    """
    Find char in s, but ignore occurrences of char inside double-quotes.
    """
    if char == '"':
        raise ValueError("can't search for a quote character with qfind")
    in_double_quotes = False
    prev_c = ''
    for k, c in enumerate(s):
        if c == '"' and (not in_double_quotes
                         or in_double_quotes and prev_c != '\\'):
            in_double_quotes = not in_double_quotes
        elif not in_double_quotes and c == char:
            return k
        prev_c = c
    return -1