def METHOD_NAME(self):
    seen = set()
    restrictions = (
        self.env.ref("l10n_br_hr.l10n_br_dependent_1"),
        self.env.ref("l10n_br_hr.l10n_br_dependent_9_1"),
        self.env.ref("l10n_br_hr.l10n_br_dependent_9_2"),
    )
    for dependent in self.dependent_ids:
        dep_type = dependent.dependent_type_id
        if dep_type not in seen and dep_type in restrictions:
            seen.add(dep_type)
        elif dep_type in seen and dep_type in restrictions:
            raise ValidationError(
                _(
                    "A dependent with the same level of relatedness"
                    " already exists for dependent %s"
                )
                % dependent.name
            )