code: func NewClient(ctx context.Context, u *url.URL, insecure bool) (*Client, error) {
  	soapClient := soap.NewClient(u, insecure)
  	vimClient, err := vim25.NewClient(ctx, soapClient)
  	if err != nil {
  		return nil, err
  	}
  
  	c := &Client{
  		Client:         vimClient,
  		SessionManager: session.NewManager(vimClient),
  	}
  
  	// Only login if the URL contains user information.
  	if u.User != nil {
  		err = c.Login(ctx, u.User)
  		if err != nil {
  			return nil, err
  		}
  	}
  
  	return c, nil
  }
docs: // NewClient creates a new client from a URL. The client authenticates with the
  // server with username/password before returning if the URL contains user information.