code: def _update_brokers(self, brokers, remove=False):
          
          log.debug("%r: _update_brokers(%r, remove=%r)",
                    self, brokers, remove)
          brokers_by_id = {bm.node_id: bm for bm in brokers}
          self._brokers.update(brokers_by_id)
  
          # Update the metadata of broker clients that already exist.
          for node_id, broker_meta in brokers_by_id.items():
              if node_id not in self.clients:
                  continue
              self.clients[node_id].updateMetadata(broker_meta)
  
          # Remove any clients for brokers which no longer exist.
          if remove:
              to_close = [
                  self.clients.pop(node_id)
                  for node_id in set(self.clients) - set(brokers_by_id)
              ]
  
              if to_close:
                  self._close_brokerclients(to_close)
docs: Update `self._brokers` and `self.clients`
  
          Update our self.clients based on brokers in received metadata
          Take the received dict of brokers and reconcile it with our current
          list of brokers (self.clients). If there is a new one, bring up a new
          connection to it, and if remove is True, and any in our current list
          aren't in the metadata returned, disconnect from it.
  
          :param brokers: Iterable of `BrokerMetadata`. A client will be created
              for every broker given if it doesn't yet exist.
          :param bool remove:
              Is this metadata for *all* brokers? If so, clients for brokers
              which are no longer found in the metadata will be closed.