code: def index_information(self, session=None):
          
          cursor = self.list_indexes(session=session)
          info = {}
          for index in cursor:
              index["key"] = index["key"].items()
              index = dict(index)
              info[index.pop("name")] = index
          return info
docs: Get information on this collection's indexes.
  
          Returns a dictionary where the keys are index names (as
          returned by create_index()) and the values are dictionaries
          containing information about each index. The dictionary is
          guaranteed to contain at least a single key, ``"key"`` which
          is a list of (key, direction) pairs specifying the index (as
          passed to create_index()). It will also contain any other
          metadata about the indexes, except for the ``"ns"`` and
          ``"name"`` keys, which are cleaned. Example output might look
          like this:
  
          >>> db.test.create_index("x", unique=True)
          u'x_1'
          >>> db.test.index_information()
          {u'_id_': {u'key': [(u'_id', 1)]},
           u'x_1': {u'unique': True, u'key': [(u'x', 1)]}}
  
          :Parameters:
            - `session` (optional): a
              :class:`~pymongo.client_session.ClientSession`.
  
          .. versionchanged:: 3.6
             Added ``session`` parameter.