'Send a kill cursors message with the given ids.'

def _kill_cursors(self, cursor_ids, address, topology):

    listeners = self._event_listeners
    publish = listeners.enabled_for_commands
    if address:
        server = topology.select_server_by_address(tuple(address))
    else:
        server = topology.select_server(writable_server_selector)
    try:
        namespace = address.namespace
        (db, coll) = namespace.split('.', 1)
    except AttributeError:
        namespace = None
        db = coll = 'OP_KILL_CURSORS'
    spec = SON([('killCursors', coll), ('cursors', cursor_ids)])
    with server.get_socket(self.__all_credentials) as sock_info:
        if ((sock_info.max_wire_version >= 4) and (namespace is not None)):
            sock_info.command(db, spec)
        else:
            if publish:
                start = datetime.datetime.now()
            (request_id, msg) = message.kill_cursors(cursor_ids)
            if publish:
                duration = (datetime.datetime.now() - start)
                listeners.publish_command_start(spec, db, request_id, tuple(address))
                start = datetime.datetime.now()
            try:
                sock_info.send_message(msg, 0)
            except Exception as exc:
                if publish:
                    dur = ((datetime.datetime.now() - start) + duration)
                    listeners.publish_command_failure(dur, message._convert_exception(exc), 'killCursors', request_id, tuple(address))
                raise
            if publish:
                duration = ((datetime.datetime.now() - start) + duration)
                reply = {'cursorsUnknown': cursor_ids, 'ok': 1}
                listeners.publish_command_success(duration, reply, 'killCursors', request_id, tuple(address))
