'Delete the :class:`~mongoengine.Document` from the database. This
will only take effect if the document has been previously saved.
:parm signal_kwargs: (optional) kwargs dictionary to be passed to
the signal calls.
:param write_concern: Extra keyword arguments are passed down which
will be used as options for the resultant
``getLastError`` command.  For example,
``save(..., write_concern={w: 2, fsync: True}, ...)`` will
wait until at least two servers have recorded the write and
will force an fsync on the primary server.
.. versionchanged:: 0.10.7
Add signal_kwargs argument'

def delete(self, signal_kwargs=None, **write_concern):

    signal_kwargs = (signal_kwargs or {})
    signals.pre_delete.send(self.__class__, document=self, **signal_kwargs)
    FileField = _import_class('FileField')
    for (name, field) in self._fields.iteritems():
        if isinstance(field, FileField):
            getattr(self, name).delete()
    try:
        self._qs.filter(**self._object_key).delete(write_concern=write_concern, _from_doc_delete=True)
    except pymongo.errors.OperationFailure as err:
        message = (u'Could    not    delete    document    (%s)' % err.message)
        raise OperationError(message)
    signals.post_delete.send(self.__class__, document=self, **signal_kwargs)
