<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def gen_slot_variable(self, cls: ClassDefinition, slotname: str) -> str: """ Generate a slot variable for slotname as defined in class """

        slot = self.schema.slots[slotname]

        # Alias allows re-use of slot names in different contexts
        if slot.alias:
            slotname = slot.alias

        range_type = self.range_type_name(slot, cls.name)
        # Python version < 3.7 -- forward references have to be quoted
        if slot.inlined and slot.range in self.schema.classes and self.forward_reference(slot.range, cls.name):
            range_type = f'"{range_type}"'
        slot_range, default_val = self.range_cardinality(range_type, slot, cls)
        default = f'= {default_val}' if default_val else ''
        return f'''{underscore(slotname)}: {slot_range} {default}'''