code: def __load_unique_identity(self, uidentity, verbose):
          
  
          uuid = uidentity.uuid
  
          if uuid:
              try:
                  api.unique_identities(self.db, uuid)
                  self.log("-- %s already exists." % uuid, verbose)
                  return uuid
              except NotFoundError as e:
                  self.log("-- %s not found. Generating a new UUID." % uuid,
                           debug=verbose)
  
          # We don't have a unique identity, so we have to create
          # a new one.
          if len(uidentity.identities) == 0:
              msg = "not enough info to load %s unique identity." % uidentity.uuid
              raise LoadError(cause=msg)
  
          identity = uidentity.identities.pop(0)
  
          try:
              stored_uuid = api.add_identity(self.db, identity.source,
                                             identity.email,
                                             identity.name,
                                             identity.username)
              self.new_uids.add(stored_uuid)
          except AlreadyExistsError as e:
              with self.db.connect() as session:
                  stored_identity = find_identity(session, e.eid)
                  stored_uuid = stored_identity.uuid
              self.warning("-- " + str(e), debug=verbose)
          except ValueError as e:
              raise LoadError(cause=str(e))
  
          self.log("-- using %s for %s unique identity." % (stored_uuid, uuid), verbose)
  
          return stored_uuid
docs: Seek or store unique identity