def METHOD_NAME(self):
    if self.stateListChannel is not None:
        # This is the case for ApertureDiameterList *configured as statelist
        # channel in xml
        statelist = self.stateListChannel.get_value()
        for statename in statelist:
            # cenvert in str because statename is numpy.int32 from Tango and deosn't
            self.stateList.append(str(statename))
    else:
        # This is the case where state names are listed in xml
        try:
            states = self["states"]
        except Exception:
            logging.getLogger().error(
                "%s does not define named states.", str(self.name())
            )
        else:
            for state in states:
                statename = state.get_property("name")
                self.stateList.append(statename)