<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _keep_alive(self):
 """ Send keep alive messages continuously to bridge. """

        send_next_keep_alive_at = 0
        while not self.is_closed:
            if not self.is_ready:
                self._reconnect()
                continue

            if time.monotonic() > send_next_keep_alive_at:
                command = KEEP_ALIVE_COMMAND_PREAMBLE + [self.wb1, self.wb2]
                self._send_raw(command)
                need_response_by = time.monotonic() + KEEP_ALIVE_TIME

            # Wait for responses
            timeout = max(0, need_response_by - time.monotonic())
            ready = select.select([self._socket], [], [], timeout)
            if ready[0]:
                try:
                    response = bytearray(12)
                    self._socket.recv_into(response)

                    if response[:5] == bytearray(KEEP_ALIVE_RESPONSE_PREAMBLE):
                        send_next_keep_alive_at = need_response_by
                except (socket.error, socket.timeout):
                    with self._lock:
                        self.is_ready = False
            elif send_next_keep_alive_at < need_response_by:
                # Acquire the lock to make sure we don't change self.is_ready
                # while _consume() is sending commands
                with self._lock:
                    self.is_ready = False