def convert_index_to_keys(d, item):<EOL>
keys = force_list(d.keys())<EOL>if isinstance(item, int):<EOL><INDENT>item = _int_to_key(keys, item)<EOL>single = True<EOL><DEDENT>elif isinstance(item, (tuple, list)):<EOL><INDENT>item2 = []<EOL>for i in item:<EOL><INDENT>i = _int_to_key(keys, i)<EOL>item2.append(i)<EOL><DEDENT>item = item2<EOL>single = False<EOL><DEDENT>elif isinstance(item, slice):<EOL><INDENT>start, stop, step = item.start, item.stop, item.step<EOL>if not isinstance(start, (NoneType, int)):<EOL><INDENT>try:<EOL><INDENT>start = keys.index(start)<EOL><DEDENT>except ValueError:<EOL><INDENT>raise KeyError('<STR_LIT>' % (start,))<EOL><DEDENT><DEDENT>if not isinstance(stop, (NoneType, int)):<EOL><INDENT>try:<EOL><INDENT>stop = keys.index(stop)<EOL><DEDENT>except ValueError:<EOL><INDENT>raise KeyError('<STR_LIT>' % (stop,))<EOL><DEDENT><DEDENT>item = keys[start:stop:step]<EOL>single = False<EOL><DEDENT>else:  <EOL><INDENT>IndexDict_check_key_type(item)<EOL>single = True<EOL><DEDENT>return item, single<EOL>
Convert ``item`` in various types (int, tuple/list, slice, or a normal key)
to a single key or a list of keys.