Add SupportsIndex by pcd1193182 · Pull Request #630 · python/typing
This PR adds a runtime SupportsIndex protocol that can be used to check at runtime if something supports the __index__ function, which is used in python to implement hex(), oct(), and bin(). This would allow typeshed to enhance the code contributed in python/typeshed#2996.
I have run the python2.7 tests locally, but have had trouble getting other versions of python installed to run the 3.3-3.6 tests. This is a pretty simple copy and modification of SupportsInt, so I imagine it will pass the tests, but still.