def METHOD_NAME(self):  # check if username dos not exist before
    if len(self.cleaned_data['username']) > 30:
        raise forms.ValidationError("Username must be under 30 characters")
    try:
        User.objects.get(username=self.cleaned_data['username'])  # get user from user model
    except User.DoesNotExist:
        return self.cleaned_data['username']
    raise forms.ValidationError("Username already exists")