code: func (mgr *IdentityManager) GetUser(username string) (*User, error) { //nolint
  
  	u, err := mgr.loadUserFromStore(username)
  	if err != nil {
  		if err != msp.ErrUserNotFound {
  			return nil, errors.WithMessage(err, "loading user from store failed")
  		}
  		// Not found, continue
  	}
  
  	if u == nil {
  		certBytes := mgr.getEmbeddedCertBytes(username)
  		if certBytes == nil {
  			certBytes, err = mgr.getCertBytesFromCertStore(username)
  			if err != nil && err != msp.ErrUserNotFound {
  				return nil, errors.WithMessage(err, "fetching cert from store failed")
  			}
  		}
  		if certBytes == nil {
  			return nil, msp.ErrUserNotFound
  		}
  		privateKey, err := mgr.getEmbeddedPrivateKey(username)
  		if err != nil {
  			return nil, errors.WithMessage(err, "fetching embedded private key failed")
  		}
  		if privateKey == nil {
  			privateKey, err = mgr.getPrivateKeyFromCert(username, certBytes)
  			if err != nil {
  				return nil, errors.WithMessage(err, "getting private key from cert failed")
  			}
  		}
  		if privateKey == nil {
  			return nil, fmt.Errorf("unable to find private key for user [%s]", username)
  		}
  		mspID, ok := comm.MSPID(mgr.config, mgr.orgName)
  		if !ok {
  			return nil, errors.New("MSP ID config read failed")
  		}
  		u = &User{
  			id:                    username,
  			mspID:                 mspID,
  			enrollmentCertificate: certBytes,
  			privateKey:            privateKey,
  		}
  	}
  	return u, nil
  }
docs: // GetUser returns a user for the given user name