backports from newer versions of the typing module we backport these features here so that python can still build while using an older python version for pythonforregen statically assert that a line of code is unreachable backport of typing assertnever introduced in python 3 11 statically assert that a line of code is unreachable backport of typing assert_never introduced in python 3 11
from typing import NoReturn


def assert_never(obj: NoReturn) -> NoReturn:
    
    raise AssertionError(f"Expected code to be unreachable, but got: {obj}")