On Python 3, some functions like range() don't try to call the __int__()
method to cast an object to integer, but try instead the __index__()
method.
Add an __index__() method to mimick correctly the int type on Python 3.
Change-Id: I8df116d80e201778714a59367600eaef644266ed