code: def listen(self, max_seconds=30):
          
          if not self.connection:
              self.connect()
          start = time.time()
          conn, _, err = select([self.connection], [], [
                                self.connection], max_seconds)
          try:
              if len(err) > 0:
                  raise socket.error("Couldn't open socket")
              message = b''
              while True:
                  if time.time() - start > max_seconds:
                      raise socket.error(
                          "Timeout of %s seconds waiting for W&B process" % max_seconds)
                  res = self.connection.recv(1024)
                  term = res.find(b'\0')
                  if term != -1:
                      message += res[:term]
                      break
                  else:
                      message += res
              message = json.loads(message.decode('utf8'))
              if message['status'] == 'done':
                  return True, None
              elif message['status'] == 'ready':
                  return True, message
              elif message['status'] == 'launch_error':
                  return False, None
              else:
                  raise socket.error("Invalid status: %s" % message['status'])
          except (socket.error, ValueError) as e:
              util.sentry_exc(e)
              return False, None
docs: Waits to receive up to two bytes for up to max_seconds