def Deserializer(stream_or_string, **options):
def process_item(item):<EOL><INDENT>m = _LIST_RE.match(item)<EOL>if m:<EOL><INDENT>contents = m.group(<NUM_LIT:1>)<EOL>if not contents:<EOL><INDENT>item = []<EOL><DEDENT>else:<EOL><INDENT>item = process_m2m(contents)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if item == '<STR_LIT>':<EOL><INDENT>item = True<EOL><DEDENT>elif item == '<STR_LIT>':<EOL><INDENT>item = False<EOL><DEDENT>elif item == '<STR_LIT>':<EOL><INDENT>item = None<EOL><DEDENT>elif (item in _QUOTED_BOOL_NULL or<EOL>_QUOTED_LIST_RE.match(item)):<EOL><INDENT>item = item.strip('<STR_LIT>')<EOL><DEDENT><DEDENT>return item<EOL><DEDENT>def process_m2m(contents):<EOL><INDENT>li = []<EOL>if _NK_LIST_RE.match(contents):<EOL><INDENT>for item in _NK_SPLIT_RE.split(contents):<EOL><INDENT>li.append(process_item(item))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>li = _SPLIT_RE.split(contents)<EOL><DEDENT>return li<EOL><DEDENT>if isinstance(stream_or_string, six.string_types):<EOL><INDENT>stream = StringIO(stream_or_string)<EOL><DEDENT>else:<EOL><INDENT>stream = stream_or_string<EOL><DEDENT>reader = UnicodeReader(stream)<EOL>header = next(reader)  <EOL>data = []<EOL>for row in reader:<EOL><INDENT>if row[:<NUM_LIT:2>] == ['<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>header = row<EOL>continue<EOL><DEDENT>d = dict(zip(header[:<NUM_LIT:2>], row[:<NUM_LIT:2>]))<EOL>d['<STR_LIT>'] = dict(zip(header[<NUM_LIT:2>:], map(process_item, row[<NUM_LIT:2>:])))<EOL>data.append(d)<EOL><DEDENT>for obj in PythonDeserializer(data, **options):<EOL><INDENT>yield obj<EOL><DEDENT>
Deserialize a stream or string of CSV data.