PEP 647 – User-Defined Type Guards | peps.python.org
This PEP specifies a way for programs to influence conditional type narrowing employed by a type checker based on runtime checks.