def _MI_init(self, *args, **kw):
items, names = [], None<EOL>n_args = len(args)<EOL>if n_args >= <NUM_LIT:1>:<EOL><INDENT>items = args[<NUM_LIT:0>]<EOL>if isinstance(items, Mapping):  <EOL><INDENT>if isinstance(items, MIMapping):<EOL><INDENT>names = force_list(items.indices.keys())  <EOL><DEDENT>items = force_list(items.items())<EOL><DEDENT>else:  <EOL><INDENT>if hasattr(items, '<STR_LIT>'):<EOL><INDENT>try:<EOL><INDENT>items = force_list(items.items())<EOL><DEDENT>except TypeError:  <EOL><INDENT>pass<EOL><DEDENT><DEDENT>else:<EOL><INDENT>items = cvt_iter(items)<EOL><DEDENT><DEDENT><DEDENT>if n_args >= <NUM_LIT:2>:<EOL><INDENT>names = args[<NUM_LIT:1>] <EOL>names = cvt_iter(names)<EOL><DEDENT>if n_args >= <NUM_LIT:3>:<EOL><INDENT>raise TypeError('<STR_LIT>' % n_args)<EOL><DEDENT>if items:  <EOL><INDENT>n_index = len(items[<NUM_LIT:0>])<EOL>for item in items[<NUM_LIT:1>:]:<EOL><INDENT>if len(item) != n_index:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>n_index = <NUM_LIT:0><EOL><DEDENT>if kw:<EOL><INDENT>if n_index == <NUM_LIT:0>:<EOL><INDENT>n_index = <NUM_LIT:2><EOL><DEDENT>else:<EOL><INDENT>if n_index != <NUM_LIT:2>:<EOL><INDENT>raise ValueError('<STR_LIT>'<EOL>'<STR_LIT>' % n_index)<EOL><DEDENT><DEDENT>items.extend(kw.items())<EOL><DEDENT>if n_index > <NUM_LIT:0>:<EOL><INDENT>if names is not None:<EOL><INDENT>if len(names) != n_index:<EOL><INDENT>raise ValueError('<STR_LIT>'<EOL>'<STR_LIT>' % (len(names), n_index))<EOL><DEDENT><DEDENT><DEDENT>if names is None:  <EOL><INDENT>names = ['<STR_LIT>' % (i+<NUM_LIT:1>) for i in range(n_index)] <EOL><DEDENT>else:<EOL><INDENT>map(MI_check_index_name, names)<EOL><DEDENT>self.indices = d = IdxOrdDict() <EOL>for index in names:<EOL><INDENT>if index in d:<EOL><INDENT>raise ValueError('<STR_LIT>' % (index, names))<EOL><DEDENT>d[index] = AttrOrdDict()<EOL><DEDENT>if n_index > <NUM_LIT:0>:<EOL><INDENT>d[<NUM_LIT:0>] = self<EOL>for item in items:<EOL><INDENT>primary_key = item[<NUM_LIT:0>]<EOL>if n_index == <NUM_LIT:1>:<EOL><INDENT>value = primary_key<EOL><DEDENT>elif n_index == <NUM_LIT:2>:<EOL><INDENT>value = item[<NUM_LIT:1>]<EOL><DEDENT>else:<EOL><INDENT>value = list(item[<NUM_LIT:1>:]) <EOL><DEDENT>_MI_setitem(self, primary_key, value)<EOL><DEDENT><DEDENT>
Separate __init__ function of MIMapping