code: def _save_account(self, account, username):
          
  
          # retrieve default project, or use null project if none
          default_project_name = self._null_project
          if account.default_project is not None:
              default_project_name = account.default_project.pid
  
          # account created
          # account updated
  
          ds_user = self.get_user(username)
          if account.date_deleted is None:
              # date_deleted is not set, user should exist
              logger.debug("account is active")
  
              if ds_user is None:
                  # create user if doesn't exist
                  self._call([
                      "add", "user",
                      "accounts=%s" % default_project_name,
                      "defaultaccount=%s" % default_project_name,
                      "name=%s" % username])
              else:
                  # or just set default project
                  self._call([
                      "modify", "user",
                      "set", "defaultaccount=%s" % default_project_name,
                      "where", "name=%s" % username])
  
              # update user meta information
  
              # add rest of projects user belongs to
              slurm_projects = self.get_projects_in_user(username)
              slurm_projects = [project.lower() for project in slurm_projects]
              slurm_projects = set(slurm_projects)
              for project in account.person.projects.all():
                  if project.pid.lower() not in slurm_projects:
                      self._call([
                          "add", "user",
                          "name=%s" % username,
                          "accounts=%s" % project.pid])
          else:
              # date_deleted is not set, user should not exist
              logger.debug("account is not active")
              self._delete_account(username)
  
          return
docs: Called when account is created/updated. With username override.