def __setitem__(self, txn_key, value):
assert type(txn_key) == tuple and len(txn_key) == <NUM_LIT:2><EOL>txn, key = txn_key<EOL>_key = struct.pack('<STR_LIT>', self._slot) + self._serialize_key(key)<EOL>_data = self._serialize_value(value)<EOL>if self._compress:<EOL><INDENT>_data = self._compress(_data)<EOL><DEDENT>_old_value = None<EOL>if self._indexes:<EOL><INDENT>_old_data = txn.get(_key)<EOL>if _old_data:<EOL><INDENT>if self._decompress:<EOL><INDENT>_old_data = self._decompress(_old_data)<EOL><DEDENT>_old_value = self._deserialize_value(_old_data)<EOL><DEDENT><DEDENT>txn.put(_key, _data)<EOL>for index in self._indexes.values():<EOL><INDENT>_fkey = index.fkey(value)<EOL>if _old_value:<EOL><INDENT>_fkey_old = index.fkey(_old_value)<EOL>if not is_null(_fkey_old) and _fkey_old != _fkey:<EOL><INDENT>_idx_key = struct.pack('<STR_LIT>', index.pmap._slot) + index.pmap._serialize_key(_fkey_old)<EOL>txn.delete(_idx_key)<EOL><DEDENT><DEDENT>if is_null(_fkey):<EOL><INDENT>if not index.nullable:<EOL><INDENT>raise _errors.NullValueConstraint(<EOL>'<STR_LIT>'.format(qual(self), index.name))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>_key = struct.pack('<STR_LIT>', index.pmap._slot) + index.pmap._serialize_key(_fkey)<EOL>_data = index.pmap._serialize_value(key)<EOL>txn.put(_key, _data)<EOL><DEDENT><DEDENT>
:param txn_key:
:param value:
:return: