def __create_index(self, keys, index_options, session, **kwargs):
        """Internal create index helper.

        :Parameters:
          - `keys`: a list of tuples [(key, type), (key, type), ...]
          - `index_options`: a dict of index options.
          - `session` (optional): a
            :class:`~pymongo.client_session.ClientSession`.
        """
        index_doc = helpers._index_document(keys)
        index = {"key": index_doc}
        collation = validate_collation_or_none(
            index_options.pop('collation', None))
        index.update(index_options)

        with self._socket_for_writes(session) as sock_info:
            if collation is not None:
                if sock_info.max_wire_version < 5:
                    raise ConfigurationError(
                        'Must be connected to MongoDB 3.4+ to use collations.')
                else:
                    index['collation'] = collation
            cmd = SON([('createIndexes', self.name), ('indexes', [index])])
            cmd.update(kwargs)
            self._command(
                sock_info, cmd, read_preference=ReadPreference.PRIMARY,
                codec_options=_UNICODE_REPLACE_CODEC_OPTIONS,
                write_concern=self._write_concern_for(session),
                session=session)
Internal create index helper.

        :Parameters:
          - `keys`: a list of tuples [(key, type), (key, type), ...]
          - `index_options`: a dict of index options.
          - `session` (optional): a
            :class:`~pymongo.client_session.ClientSession`.
        
stackoverflow/venv/lib/python3.6/site-packages/pymongo/collection.py