def validate(self) -> None:
    """Raises an exception if this configuration is invalid."""
    # Run any custom validation logic provided by a subclass's implementation.
    self._validate_self()

    # Validate any sub-configs.
    for field_name in self._field_names:
      value = getattr(self, field_name)
      if isinstance(value, Config):
        value.validate()
Raises an exception if this configuration is invalid.
language/canine/config_utils.py