<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _kill_cursors(self, cursor_ids, address, topology, session):
 """Send a kill cursors message with the given ids."""

        listeners = self._event_listeners
        publish = listeners.enabled_for_commands
        if address:
            # address could be a tuple or _CursorAddress, but
            # select_server_by_address needs (host, port).
            server = topology.select_server_by_address(tuple(address))
        else:
            # Application called close_cursor() with no address.
            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, session=session, client=self)
            else:
                if publish:
                    start = datetime.datetime.now()
                request_id, msg = message.kill_cursors(cursor_ids)
                if publish:
                    duration = datetime.datetime.now() - start
                    # Here and below, address could be a tuple or
                    # _CursorAddress. We always want to publish a
                    # tuple to match the rest of the monitoring
                    # API.
                    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)
                    # OP_KILL_CURSORS returns no reply, fake one.
                    reply = {'cursorsUnknown': cursor_ids, 'ok': 1}
                    listeners.publish_command_success(
                        duration, reply, 'killCursors', request_id,
                        tuple(address))