code: func (m *GormIdentityRepository) Lookup(ctx context.Context, username, profileURL, providerType string) (*Identity, error) {
  	if username == "" || profileURL == "" || providerType == "" {
  		return nil, errs.New("Cannot lookup identity with empty username, profile URL or provider type")
  	}
  	log.Debug(nil, nil, "Looking for identity of user with profile URL=%s\n", profileURL)
  	// bind the assignee to an existing identity, or create a new one
  	identity, err := m.First(IdentityFilterByProfileURL(profileURL))
  	if err != nil {
  		return nil, errs.Wrapf(err, "failed to lookup identity by profileURL '%s'", profileURL)
  	}
  	if identity == nil {
  		// create the identity if it does not exist yet
  		log.Debug(nil, nil, "Creating an identity for username '%s' with profile '%s' on '%s'\n", username, profileURL, providerType)
  		identity = &Identity{
  			ProviderType: providerType,
  			Username:     username,
  			ProfileURL:   &profileURL,
  		}
  		err = m.Create(context.Background(), identity)
  		if err != nil {
  			return nil, errs.Wrap(err, "failed to create identity during lookup")
  		}
  	} else {
  		// use existing identity
  		log.Debug(nil, nil, "Using existing identity with ID: %v", identity.ID.String())
  	}
  	log.Debug(nil, nil, "Found identity of user with profile URL=%s: %s", profileURL, identity.ID)
  	return identity, nil
  }
docs: // Lookup looks for an existing identity with the given `profileURL` or creates a new one