'A generalized key-value parser. Handles whitespace, csv etc.
Args:
comments: Line comment patterns (e.g. "#").
cont: Continuation patterns (e.g. "\").
kv_sep: Key/Value separators (e.g. "=" or ":").
ml_quote: Boolean flag to allow quoted strings to span lines.
quot: Quotation patterns (e.g. "\"" or "\'").
sep: Field separator patterns (e.g. "[\s,]").
term: Entry termination patterns (e.g. "\n").
verbose: Enable verbose mode for the lexer. Useful for debugging.'

def __init__(self, comments='#', cont='\\\\\\s*\\n', kv_sep='=', ml_quote=False, quot=('\\"', "'"), sep='[    \\t\\f\\v]+', term='[\\r\\n]', verbose=0):

    self.kv_sep = AsIter(kv_sep)
    super(KeyValueParser, self).__init__(comments=comments, cont=cont, ml_quote=ml_quote, quot=quot, sep=sep, term=term, verbose=verbose)
    self.key_field = ''
