def save(self, *args, **kwargs):
created = self.pk is None<EOL>sync_emailaddress = kwargs.pop('<STR_LIT>', True)<EOL>if created and self.has_usable_password() is False:<EOL><INDENT>self.set_password(self.password)<EOL><DEDENT>super(Profile, self).save(*args, **kwargs)<EOL>if created and self.groups.count() < <NUM_LIT:1>:<EOL><INDENT>try:<EOL><INDENT>default_group = Group.objects.get(name='<STR_LIT>')<EOL>self.groups.add(default_group)<EOL><DEDENT>except Group.DoesNotExist:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>if (EMAIL_CONFIRMATION and sync_emailaddress<EOL>and self.email  <EOL>and self.email_set.filter(email=self.email).count() < <NUM_LIT:1>):  <EOL><INDENT>self.email_set.add_email(self, email=self.email)<EOL>self.email_set.last().set_as_primary()<EOL><DEDENT>
performs actions on create:
    * ensure instance has usable password
    * set default group
    * keep in sync with email address model