'Internal delete helper.'

def _delete(self, sock_info, criteria, multi, write_concern=None, op_id=None, ordered=True, collation=None):

    common.validate_is_mapping('filter', criteria)
    concern = (write_concern or self.write_concern).document
    acknowledged = (concern.get('w') != 0)
    delete_doc = SON([('q', criteria), ('limit', int((not multi)))])
    collation = validate_collation_or_none(collation)
    if (collation is not None):
        if (sock_info.max_wire_version < 5):
            raise ConfigurationError('Must    be    connected    to    MongoDB    3.4+    to    use    collations.')
        elif (not acknowledged):
            raise ConfigurationError('Collation    is    unsupported    for    unacknowledged    writes.')
        else:
            delete_doc['collation'] = collation
    command = SON([('delete', self.name), ('ordered', ordered), ('deletes', [delete_doc])])
    if concern:
        command['writeConcern'] = concern
    if ((sock_info.max_wire_version > 1) and acknowledged):
        result = sock_info.command(self.__database.name, command, codec_options=self.__write_response_codec_options)
        _check_write_command_response([(0, result)])
        return result
    else:
        return self._legacy_write(sock_info, 'delete', command, acknowledged, op_id, False, message.delete, self.__full_name, criteria, acknowledged, concern, self.__write_response_codec_options, int((not multi)))
