How can I access (read/write) a mesh object's index vi Python? I would like to retrieve from python the index of an object -- the same index that you get when using an Object info node in shader nodes.

I have a reference to the object, but I don't see any attribute named index, or any function that returns it.
https://docs.blender.org/manual/en/latest/render/cycles/nodes/types/input/object_info.html

bpy.context.object.pass_index