def clean(self):
        if any(self.errors):
            return

        skills = []

        for form in self.forms:
            if form.cleaned_data:
                skill = form.cleaned_data['skill']
                proficiency = form.cleaned_data['proficiency']

                # Check that no two skills are the same
                if skill and proficiency:
                    if skill in skills:
                        raise forms.ValidationError(
                            _('Each skill can only be entered once.'),
                            code='duplicate_skill'
                        )

                    skills.append(skill)

                # Check that all skills have both a name and proficiency
                if skill and not proficiency:

                    raise forms.ValidationError(
                        _('All skills must have a proficiency.'),
                        code='missing_proficiency'
                    )

                elif proficiency and not skill:
                    raise forms.ValidationError(
                        _('All skills must have a skill name.'),
                        code='missing_skill_name'
                    )
Adds validation to check that no skill is listed twice
dataset/ETHPy150Open nlhkabu/connect/connect/accounts/forms.py/BaseSkillFormSet.clean