<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def clean(self):
 """ automatically sets groupname """

        super().clean()
        if self.group:
            self.groupname = self.group.name
        elif not self.groupname:
            raise ValidationError({
                'groupname': _NOT_BLANK_MESSAGE,
                'group': _NOT_BLANK_MESSAGE
            })