def classify(self, type: int, value: str, context: Context) -> list[int]:
        """Turn a token into a label.  (Internal)

        Depending on whether the value is a soft-keyword or not,
        this function may return multiple labels to choose from."""
        if type == token.NAME:
            # Keep a listing of all used names
            self.used_names.add(value)
            # Check for reserved words
            if value in self.grammar.keywords:
                return [self.grammar.keywords[value]]
            elif value in self.grammar.soft_keywords:
                assert type in self.grammar.tokens
                # Current soft keywords (match, case, type) can only appear at the
                # beginning of a statement. So as a shortcut, don't try to treat them
                # like keywords in any other context.
                # ('_' is also a soft keyword in the real grammar, but for our grammar
                # it's just an expression, so we don't need to treat it specially.)
                if self.last_token not in (
                    None,
                    token.INDENT,
                    token.DEDENT,
                    token.NEWLINE,
                    token.SEMI,
                    token.COLON,
                ):
                    return [self.grammar.tokens[type]]
                return [
                    self.grammar.tokens[type],
                    self.grammar.soft_keywords[value],
                ]

        ilabel = self.grammar.tokens.get(type)
        if ilabel is None:
            raise ParseError("bad token", type, value, context)
        return [ilabel]
Turn a token into a label.  (Internal)

        Depending on whether the value is a soft-keyword or not,
        this function may return multiple labels to choose from.
src/blib2to3/pgen2/parse.py