def _quoted_split(s, separator=',', quotes='"'):
    """Splits a string considering quotes.

    e.g. _quoted_split('a,"b,c",d') -> ['a', '"b,c"', 'd']
    """
    splits = []
    partial = []
    in_quote = None
    for c in s:
        if in_quote:
            if c == in_quote:
                in_quote = None
        elif c in quotes:
            in_quote = c
        if not in_quote and c in separator:
            if partial:
                splits.append(''.join(partial))
            partial = []
        else:
            partial.append(c)
    if partial:
        splits.append(''.join(partial))
    return splits
