<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def ancestors(self, definition: Union[SLOT_OR_SLOTNAME, CLASS_OR_CLASSNAME]) \ -> List[Union[SlotDefinitionName, ClassDefinitionName]]: """ Return an ordered list of ancestor names for the supplied slot or class @param definition: Slot or class name or definition @return: List of ancestor names """

        definition = self.obj_for(definition)
        if definition is not None:
            return [definition.name] + self.ancestors(definition.is_a)
        else:
            return []