code: func (d *Daemon) CheckLeader(c *check.C) (interface{}, check.CommentInterface) {
  	cli := d.NewClientT(c)
  	defer cli.Close()
  
  	errList := check.Commentf("could not get node list")
  
  	ls, err := cli.NodeList(context.Background(), types.NodeListOptions{})
  	if err != nil {
  		return err, errList
  	}
  
  	for _, node := range ls {
  		if node.ManagerStatus != nil && node.ManagerStatus.Leader {
  			return nil, nil
  		}
  	}
  	return fmt.Errorf("no leader"), check.Commentf("could not find leader")
  }
docs: // CheckLeader returns whether there is a leader on the swarm or not