also added some .pyi files needed to check the cython code (taken from #5703 and updated). fixed "syntax error" in key.py. all mypy complaints not fixed yet.