code: async def wait_slaves(self, timeout, check_ready=False):
          
          status = 'ready' if check_ready else 'online'
          self._log(logging.DEBUG,
                    "Waiting for slaves to become {}...".format(status))
          t = time.monotonic()
          online = []
          while len(online) < len(self.addrs):
              for addr in self.addrs:
                  if time.monotonic() - t > timeout:
                      self._log(logging.DEBUG, "Timeout while waiting for the "
                                "slaves to become {}.".format(status))
                      return False
                  if addr not in online:
                      try:
                          r_manager = await self.env.connect(addr, timeout)
                          ready = True
                          if check_ready:
                              ready = await r_manager.is_ready()
                          if ready:
                              online.append(addr)
                              self._log(logging.DEBUG, "Slave {}/{} {}: {}"
                                        .format(len(online),
                                                len(self.addrs),
                                                status,
                                                addr))
                      except:
                          pass
              asyncio.sleep(0.5)
          self._log(logging.DEBUG, "All slaves {} in {} seconds!"
                    .format(status, time.monotonic() - t))
          return True
docs: Wait until all slaves are online (their managers accept connections)
          or timeout expires.
  
          :param int timeout:
              Timeout (in seconds) after which the method will return even though
              all the slaves are not online yet.
  
          :param bool check_ready:
              If ``True`` also checks if all slave environment's are ready.
              A slave environment is assumed to be ready when its manager's
              :meth:`is_ready`-method returns ``True``.
  
          .. seealso::
  
              :meth:`creamas.core.environment.Environment.is_ready`,
              :meth:`creamas.mp.EnvManager.is_ready`,
              :meth:`creamas.mp.MultiEnvManager.is_ready`