code: def save_account(self, account: Account) -> None:
          
          person = account.person
          if self._primary_group == 'institute':
              lgroup = self._get_group(person.institute.group.name)
          elif self._primary_group == 'default_project':
              if account.default_project is None:
                  lgroup = self._get_group(self._default_primary_group)
              else:
                  lgroup = self._get_group(account.default_project.group.name)
          else:
              raise RuntimeError("Unknown value of PRIMARY_GROUP.")
  
          if account.default_project is None:
              default_project = "none"
          else:
              default_project = account.default_project.pid
  
          try:
              luser = self._get_account(account.username)
              changes = changeset(luser, {})
              new_user = False
          except ObjectDoesNotExist:
              new_user = True
              luser = self._account_class()
              changes = changeset(luser, {
                  'uid': account.username
              })
  
          changes = changes.merge({
              'gidNumber': lgroup['gidNumber'],
              'givenName': person.first_name,
              'sn': person.last_name,
              'telephoneNumber': _str_or_none(person.telephone),
              'mail': _str_or_none(person.email),
              'title': _str_or_none(person.title),
              'o': person.institute.name,
              'cn': person.full_name,
              'default_project': default_project,
              'loginShell': account.shell,
              'locked': account.is_locked()
          })
          save(changes, database=self._database)
  
          if new_user:
              # add all groups
              for group in account.person.groups.all():
                  self.add_account_to_group(account, group)
docs: Account was saved.