def _validate_and_update(self, attribute):
    """Validates the current values on this WorkUnit and propegates updates.

    This method validates the current WorkUnit and performs any updates that
    occur as side-effects, such as updating the start and end time. This
    method also calls change listeners and propagates change calls to parent
    WorkUnits.

    Args:
      attribute: A string value corresponding to the name of the attribute
          that was updated.
    Raises:
      ValueError: A ValueError is raised if any of the current values are
          in an invalid state. For instance, if the completed count is greater
          that the total count.
    """
    if (not self._total == None and
        not self._complete == None and
        self._complete > self._total):
      raise ValueError('Complete tasks cannot be more than the total tasks.')
    if not self.start_time:
      self.start_time = util.timer()
    if self.total == self.complete and not self.total == None:
      self.end_time = util.timer()
    self._waiting = False
    for listener in self.listeners:
      listener.update(self, attribute, getattr(self, attribute))
    if self.parent:
      self.parent._validate_and_update(attribute)
dataset/ETHPy150Open google/anvil-build/anvil/build_logging.py/WorkUnit._validate_and_update/original