code: def flushOutBoxes(self) -> None:
          
          removedRemotes = []
          for rid, msgs in self.outBoxes.items():
              try:
                  dest = self.remotes[rid].name
              except KeyError:
                  removedRemotes.append(rid)
                  continue
              if msgs:
                  if self._should_batch(msgs):
                      logger.trace(
                          "{} batching {} msgs to {} into fewer transmissions".
                          format(self, len(msgs), dest))
                      logger.trace("    messages: {}".format(msgs))
                      batches = split_messages_on_batches(list(msgs),
                                                          self._make_batch,
                                                          self._test_batch_len,
                                                          )
                      msgs.clear()
                      if batches:
                          for batch, size in batches:
                              logger.trace("{} sending payload to {}: {}".format(
                                  self, dest, batch))
                              self.metrics.add_event(MetricsName.TRANSPORT_BATCH_SIZE, size)
                              # Setting timeout to never expire
                              self.transmit(
                                  batch,
                                  rid,
                                  timeout=self.messageTimeout,
                                  serialized=True)
                      else:
                          logger.error("{} cannot create batch(es) for {}".format(self, dest))
                  else:
                      while msgs:
                          msg = msgs.popleft()
                          logger.trace(
                              "{} sending msg {} to {}".format(self, msg, dest))
                          self.metrics.add_event(MetricsName.TRANSPORT_BATCH_SIZE, 1)
                          # Setting timeout to never expire
                          self.transmit(msg, rid, timeout=self.messageTimeout,
                                        serialized=True)
  
          for rid in removedRemotes:
              logger.warning("{}{} has removed rid {}"
                             .format(CONNECTION_PREFIX, self,
                                     z85_to_friendly(rid)),
                             extra={"cli": False})
              msgs = self.outBoxes[rid]
              if msgs:
                  self.discard(msgs,
                               "{}rid {} no longer available"
                               .format(CONNECTION_PREFIX,
                                       z85_to_friendly(rid)),
                               logMethod=logger.debug)
              del self.outBoxes[rid]
docs: Clear the outBoxes and transmit batched messages to remotes.