def __setitem__(self, keys, value):
if(type(keys) in [tuple, list]):<EOL><INDENT>at_least_one_key_exists = False<EOL>num_of_keys_we_have = <NUM_LIT:0><EOL>for x in keys:<EOL><INDENT>try:<EOL><INDENT>self.__getitem__(x)<EOL>num_of_keys_we_have += <NUM_LIT:1><EOL><DEDENT>except Exception as err:<EOL><INDENT>continue<EOL><DEDENT><DEDENT>if num_of_keys_we_have:<EOL><INDENT>all_select_same_item = True<EOL>direct_key = None<EOL>for key in keys:<EOL><INDENT>key_type = str(type(key))<EOL>try:<EOL><INDENT>if not direct_key:<EOL><INDENT>direct_key = self.__dict__[key_type][key]<EOL><DEDENT>else:<EOL><INDENT>new = self.__dict__[key_type][key]<EOL>if new != direct_key:<EOL><INDENT>all_select_same_item = False<EOL>break<EOL><DEDENT><DEDENT><DEDENT>except Exception as err:<EOL><INDENT>all_select_same_item = False<EOL>break;<EOL><DEDENT><DEDENT>if not all_select_same_item:<EOL><INDENT>raise KeyError('<STR_LIT:U+002CU+0020>'.join(str(key) for key in keys))<EOL><DEDENT><DEDENT>first_key = keys[<NUM_LIT:0>] <EOL><DEDENT>else:<EOL><INDENT>first_key = keys<EOL><DEDENT>key_type = str(type(first_key)) <EOL>if first_key in self:<EOL><INDENT>self.items_dict[self.__dict__[key_type][first_key]] = value <EOL><DEDENT>else:<EOL><INDENT>if(type(keys) not in [tuple, list]):<EOL><INDENT>key = keys<EOL>keys = [keys]<EOL><DEDENT>self.__add_item(value, keys)<EOL><DEDENT>
Set the value at index (or list of indexes) specified as keys.
            Note, that if multiple key list is specified, either: 
              - none of keys should map to an existing item already (item creation), or 
              - all of keys should map to exactly the same item (as previously created)
                  (item update)
            If this is not the case - KeyError is raised.