<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def create_index(self, collection, index_name, **kwargs):
 """Safely attempt to create index."""

        try:
            self.connection[collection].create_index(index_name, **kwargs)
        except Exception as exc:
            LOG.warn("Error tuning mongodb database: %s", exc)