'Creates the given indexes if required.
:param keys: a single index key or a list of index keys (to
construct a multi-field index); keys may be prefixed with a **+**
or a **-** to determine the index ordering
:param background: Allows index creation in the background'

@classmethod
def create_index(cls, keys, background=False, **kwargs):

    index_spec = cls._build_index_spec(keys)
    index_spec = index_spec.copy()
    fields = index_spec.pop('fields')
    drop_dups = kwargs.get('drop_dups', False)
    if (IS_PYMONGO_3 and drop_dups):
        msg = 'drop_dups    is    deprecated    and    is    removed    when    using    PyMongo    3+.'
        warnings.warn(msg, DeprecationWarning)
    elif (not IS_PYMONGO_3):
        index_spec['drop_dups'] = drop_dups
    index_spec['background'] = background
    index_spec.update(kwargs)
    if IS_PYMONGO_3:
        return cls._get_collection().create_index(fields, **index_spec)
    else:
        return cls._get_collection().ensure_index(fields, **index_spec)
