def _set_slot(self, slot_index, slot):
assert type(slot_index) in six.integer_types<EOL>assert slot_index > <NUM_LIT:0> and slot_index < <NUM_LIT><EOL>assert slot is None or isinstance(slot, Slot)<EOL>if slot:<EOL><INDENT>assert slot_index == slot.slot<EOL><DEDENT>key = b'<STR_LIT>' + struct.pack('<STR_LIT>', slot_index)<EOL>if slot:<EOL><INDENT>data = cbor2.dumps(slot.marshal())<EOL>with self.begin(write=True) as txn:<EOL><INDENT>txn._txn.put(key, data)<EOL>self._slots[slot.oid] = slot<EOL>self._slots_by_index[slot.oid] = slot_index<EOL><DEDENT>self.log.debug('<STR_LIT>',<EOL>oid=slot.oid,<EOL>slot_index=slot_index)<EOL><DEDENT>else:<EOL><INDENT>with self.begin(write=True) as txn:<EOL><INDENT>result = txn.get(key)<EOL>if result:<EOL><INDENT>txn._txn.delete(key)<EOL><DEDENT>if slot.oid in self._slots:<EOL><INDENT>del self._slots[slot.oid]<EOL><DEDENT>if slot.oid in self._slots_by_index:<EOL><INDENT>del self._slots_by_index[slot.oid]<EOL><DEDENT><DEDENT>self.log.debug('<STR_LIT>',<EOL>oid=slot.oid,<EOL>slot_index=slot_index)<EOL><DEDENT>
:param slot_index:
:param meta:
:return: