code: def set_from_descendants(self, descendants):
          
          for field in self.fields:
  
              # This gives a set of metadata values of all the parents
              # of any new cluster.
              candidates = defaultdict(set)
              for old, new in descendants:
                  candidates[new].add(self.get(field, old))
  
              # Loop over all new clusters.
              for new, vals in candidates.items():
                  vals = list(vals)
                  default = self._fields[field]
                  # If all the parents have the same value, assign it to
                  # the new cluster if it is not the default.
                  if len(vals) == 1 and vals[0] != default:
                      self.set(field, new, vals[0])
docs: Update metadata of some clusters given the metadata of their
          ascendants.