def gen_postinit(self, cls: ClassDefinition, slotname: str) -> Optional[str]:
rlines: List[str] = []<EOL>slot = self.schema.slots[slotname]<EOL>if slot.alias:<EOL><INDENT>slotname = slot.alias<EOL><DEDENT>slotname = self.python_name_for(slotname)<EOL>range_type_name = self.range_type_name(slot, cls.name)<EOL>if slot.primary_key or slot.identifier or slot.required:<EOL><INDENT>if cls.is_a:<EOL><INDENT>rlines.append(f'<STR_LIT>')<EOL>rlines.append(f'<STR_LIT>')<EOL>rlines.append(f'<STR_LIT>')<EOL>rlines.append(f'<STR_LIT>')<EOL><DEDENT><DEDENT>elif slot.range in self.schema.classes or slot.range in self.schema.types:<EOL><INDENT>if not slot.multivalued:<EOL><INDENT>rlines.append(f'<STR_LIT>')<EOL>if slot.range in self.schema.classes and not self.all_slots_for(self.schema.classes[slot.range]):<EOL><INDENT>rlines.append(f'<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>rlines.append(f'<STR_LIT>')<EOL><DEDENT><DEDENT>elif slot.inlined:<EOL><INDENT>slot_range_cls = self.schema.classes[slot.range]<EOL>pkeys = self.primary_keys_for(slot_range_cls)<EOL>if pkeys:<EOL><INDENT>if len(self.all_slots_for(slot_range_cls)) - len(pkeys) == <NUM_LIT:1>:<EOL><INDENT>class_init = '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>pkey_name = self.python_name_for(pkeys[<NUM_LIT:0>])<EOL>class_init = f'<STR_LIT>'<EOL><DEDENT>rlines.append(f'<STR_LIT>')<EOL>rlines.append(f'<STR_LIT>')<EOL>rlines.append(f'<STR_LIT>')<EOL><DEDENT><DEDENT>else:<EOL><INDENT>rlines.append(f'<STR_LIT>')<EOL>indent = len(f'<STR_LIT>') * '<STR_LIT:U+0020>'<EOL>rlines.append(f'<STR_LIT>')<EOL><DEDENT><DEDENT>return '<STR_LIT>'.join(rlines)<EOL>
Generate python post init rules for slot in class