def METHOD_NAME(self, item: NameLeaf) -> Set[str]:
    if item.value not in self.rules:
        return {item.value}
    if item.value not in self.first_sets:
        self.first_sets[item.value] = self.visit(self.rules[item.value])
        return self.first_sets[item.value]
    elif item.value in self.in_process:
        return set()
    return self.first_sets[item.value]