def METHOD_NAME(
    self,
    defaults: dict[str, dict[str, Any]],
    targets_defaults: SetDefaultsT,
    ignore_unknown_fields: bool = False,
    ignore_unknown_targets: bool = False,
):
    if not isinstance(targets_defaults, dict):
        raise ValueError(
            f"Expected dictionary mapping targets to default field values for {self.address} "
            f"but got: {type(targets_defaults).__name__}."
        )
    types = self.registered_target_types.aliases_to_types
    for target, default in targets_defaults.items():
        if not isinstance(default, dict):
            raise ValueError(
                f"Invalid default field values in {self.address} for target type {target}, "
                f"must be an `dict` but was {default!r} with type `{type(default).__name__}`."
            )
        targets: Iterable[str]
        targets = target if isinstance(target, tuple) else (target,)
        for target_alias in map(str, targets):
            if target_alias in types:
                target_type = types[target_alias]
            elif ignore_unknown_targets:
                continue
            else:
                raise ValueError(f"Unrecognized target type {target_alias} in {self.address}.")
            # Copy default dict if we may mutate it.
            raw_values = dict(default) if ignore_unknown_fields else default
            # Validate that field exists on target
            valid_field_aliases = set(
                target_type._get_field_aliases_to_field_types(
                    self._target_type_field_types(target_type)
                ).keys()
            )
            for field_alias in default.keys():
                if field_alias not in valid_field_aliases:
                    if ignore_unknown_fields:
                        del raw_values[field_alias]
                    else:
                        raise InvalidFieldException(
                            f"Unrecognized field `{field_alias}` for target {target_type.alias}. "
                            f"Valid fields are: {', '.join(sorted(valid_field_aliases))}.",
                        )
            # Merge all provided defaults for this call.
            defaults.setdefault(target_type.alias, {}).update(raw_values)