code: def _update_observers(self, batch_id, status):
          
          for observer, statuses in self._observers.copy().items():
              if batch_id in statuses:
                  statuses[batch_id] = status
                  if self._has_no_pendings(statuses):
                      observer.notify_batches_finished(statuses)
                      self._observers.pop(observer)
docs: Updates each observer tracking a particular batch with its new
          status. If all statuses are no longer pending, notifies the observer
          and removes it from the list.