'Deletes documents.
Requires *either* ``id`` or ``query``. ``id`` is if you know the
specific document id to remove. Note that ``id`` can also be a list of
document ids to be deleted. ``query`` is a Lucene-style query
indicating a collection of documents to delete.
Optionally accepts ``commit``. Default is ``True``.
Optionally accepts ``softCommit``. Default is ``False``.
Optionally accepts ``waitFlush``. Default is ``None``.
Optionally accepts ``waitSearcher``. Default is ``None``.
Usage::
solr.delete(id=\'doc_12\')
solr.delete(id=[\'doc_1\', \'doc_3\'])
solr.delete(q=\'*:*\')'

def delete(self, id=None, q=None, commit=True, softCommit=False, waitFlush=None, waitSearcher=None, handler=u'update'):

    if ((id is None) and (q is None)):
        raise ValueError(u'You    must    specify    "id"    or    "q".')
    elif ((id is not None) and (q is not None)):
        raise ValueError(u'You    many    only    specify    "id"    OR    "q",    not    both.')
    elif (id is not None):
        if (not isinstance(id, (list, set, tuple))):
            id = [id]
        else:
            id = list(filter(None, id))
        if id:
            m = (u'<delete>%s</delete>' % u''.join(((u'<id>%s</id>' % i) for i in id)))
        else:
            raise ValueError(u'The    list    of    documents    to    delete    was    empty.')
    elif (q is not None):
        m = (u'<delete><query>%s</query></delete>' % q)
    return self._update(m, commit=commit, softCommit=softCommit, waitFlush=waitFlush, waitSearcher=waitSearcher, handler=handler)
