def __setitem(self, chunk, key, keys, value, extend=False):
def setitem(chunk):<EOL><INDENT>if keys:<EOL><INDENT>return self.__setitem(chunk, keys[<NUM_LIT:0>], keys[<NUM_LIT:1>:], value, extend)<EOL><DEDENT>else:<EOL><INDENT>return value<EOL><DEDENT><DEDENT>if key in ['<STR_LIT:.>', '<STR_LIT:]>']:<EOL><INDENT>chunk[key] = value<EOL><DEDENT>elif '<STR_LIT:]>' in key:  <EOL><INDENT>key = int(key[:-<NUM_LIT:1>].replace('<STR_LIT:n>', '<STR_LIT>'))<EOL>if extend:<EOL><INDENT>if chunk is None:<EOL><INDENT>chunk = [None, ]<EOL><DEDENT>else:<EOL><INDENT>if not isinstance(chunk, list):<EOL><INDENT>chunk = [chunk, ]<EOL><DEDENT>if key != -<NUM_LIT:1>:<EOL><INDENT>chunk.insert(key, None)<EOL><DEDENT>else:<EOL><INDENT>chunk.append(None)<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>if chunk is None:<EOL><INDENT>chunk = [None, ]<EOL><DEDENT><DEDENT>chunk[key] = setitem(chunk[key])<EOL><DEDENT>else:  <EOL><INDENT>if extend:<EOL><INDENT>if chunk is None:<EOL><INDENT>chunk = {}<EOL>chunk[key] = None<EOL>chunk[key] = setitem(chunk[key])<EOL><DEDENT>elif key not in chunk:<EOL><INDENT>chunk[key] = None<EOL>chunk[key] = setitem(chunk[key])<EOL><DEDENT>else:<EOL><INDENT>if keys:<EOL><INDENT>chunk[key] = setitem(chunk[key])<EOL><DEDENT>else:<EOL><INDENT>if not isinstance(chunk[key], list):<EOL><INDENT>chunk[key] = [chunk[key], ]<EOL><DEDENT>chunk[key].append(None)<EOL>chunk[key][-<NUM_LIT:1>] = setitem(chunk[key][-<NUM_LIT:1>])<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>if chunk is None:<EOL><INDENT>chunk = {}<EOL><DEDENT>if key not in chunk:<EOL><INDENT>chunk[key] = None<EOL><DEDENT>chunk[key] = setitem(chunk[key])<EOL><DEDENT><DEDENT>return chunk<EOL>
Helper function to fill up the dictionary.