code: def __load_identities(self, identities, uuid, verbose):
          
  
          self.log("-- loading identities", verbose)
  
          for identity in identities:
              try:
                  api.add_identity(self.db, identity.source, identity.email,
                                   identity.name, identity.username, uuid)
                  self.new_uids.add(uuid)
              except AlreadyExistsError as e:
                  self.warning(str(e), verbose)
  
                  with self.db.connect() as session:
                      stored_identity = find_identity(session, e.eid)
                      stored_uuid = stored_identity.uuid
  
                  if uuid != stored_uuid:
                      msg = "%s is already assigned to %s. Merging." % (uuid, stored_uuid)
                      self.warning(msg, verbose)
  
                      api.merge_unique_identities(self.db, uuid, stored_uuid)
  
                      if uuid in self.new_uids:
                          self.new_uids.remove(uuid)
  
                      self.new_uids.add(stored_uuid)
                      uuid = stored_uuid
  
          self.log("-- identities loaded", verbose)
  
          return uuid
docs: Store identities