code: def _accept_loop(self):
          
          self._listening_sock.setblocking(0)
          while not self._stopped and not _shutting_down:
              try:
                  # Wait a short time to accept.
                  if select.select([self._listening_sock.fileno()], [], [], 1):
                      client, client_addr = self._listening_sock.accept()
                      client.setblocking(True)
                      self._log('connection from %s' % format_addr(client_addr))
                      server_thread = threading.Thread(
                          target=functools.partial(
                              self._server_loop, client, client_addr))
  
                      # Store weakrefs to the thread and socket, so we can
                      # dispose them in stop().
                      self._server_threads[server_thread] = None
                      self._server_socks[client] = None
  
                      server_thread.daemon = True
                      server_thread.start()
              except socket.error as error:
                  if error.errno not in (
                      errno.EAGAIN, errno.EBADF, errno.EWOULDBLOCK):
                      raise
              except select.error as error:
                  if error.args[0] == errno.EBADF:
                      # Closed.
                      break
                  else:
                      raise
docs: Accept client connections and spawn a thread for each.