def METHOD_NAME(self, grant):
    request: OAuth2Request = grant.request
    verifier = request.form.get('code_verifier')
    # public client MUST verify code challenge
    if self.required and request.auth_method == 'none' and not verifier:
        raise InvalidRequestError('Missing "code_verifier"')
    authorization_code = request.authorization_code
    challenge = self.get_authorization_code_challenge(authorization_code)
    # ignore, it is the normal RFC6749 authorization_code request
    if not challenge and not verifier:
        return
    # challenge exists, code_verifier is required
    if not verifier:
        raise InvalidRequestError('Missing "code_verifier"')
    if not CODE_VERIFIER_PATTERN.match(verifier):
        raise InvalidRequestError('Invalid "code_verifier"')
    # 4.6. Server Verifies code_verifier before Returning the Tokens
    method = self.get_authorization_code_challenge_method(authorization_code)
    if method is None:
        method = self.DEFAULT_CODE_CHALLENGE_METHOD
    func = self.CODE_CHALLENGE_METHODS.get(method)
    if not func:
        raise RuntimeError(f'No verify method for "{method}"')
    # If the values are not equal, an error response indicating
    # "invalid_grant" MUST be returned.
    if not func(verifier, challenge):
        raise InvalidGrantError(description='Code challenge failed.')