def METHOD_NAME(
    self, code: str, client: OAuth2Client
) -> OAuth2AuthorizationCode | None:
    auth_code = OAuth2AuthorizationCode.query.filter_by(
        code=code, client_id=client.client_id
    ).first()
    if auth_code and not auth_code.is_expired():
        return auth_code
    return None