<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _write_socket(self):
 """ Pass messages from queue to socket. """

        while True:
            now = time.time()
            if self._connected and (self._last_sync + SYNC_AFTER) < now:
                self._queue.put(request_packet(MSG_TIME))
                self._last_sync = now
            if not self._queue.empty():
                self._socket.send(self._queue.get())