def METHOD_NAME(self, value: str) -> str:
    label = underscore(value)
    if label.isidentifier():
        return label
    else:
        # add an underscore if the value starts with a digit
        label = re.sub(r"(?=^\d)", "number_", label)
        safe_label = ""
        for character in label:
            safe_label += self.replace_invalid_identifier_character(character)
        return safe_label