def quoted_split(string, sep, quotes='"'):
    """
    Split a string on the given separation character, but respecting
    double-quoted sections of the string.  Returns an iterator.

    :param string: The string to split.
    :param sep: The character separating sections of the string.
    :param quotes: A string specifying all legal quote characters.

    :returns: An iterator which will iterate over each element of the
              string separated by the designated separator.
    """
    start = None
    escape = False
    quote = False
    for i, c in enumerate(string):
        if start is None:
            start = i
        if escape:
            escape = False
        elif quote:
            if c == '\\':
                escape = True
            elif c == quote:
                quote = False
        elif c == sep:
            yield string[start:i]
            start = None
        elif c in quotes:
            quote = c
    if start is not None:
        yield string[start:]
