code: func CompareExpiryUbiquity(chain1, chain2 []*x509.Certificate) int {
  	for i := 0; ; i++ {
  		if i >= len(chain1) || i >= len(chain2) {
  			break
  		}
  		c1 := chain1[len(chain1)-1-i]
  		c2 := chain2[len(chain2)-1-i]
  		t1 := c1.NotAfter
  		t2 := c2.NotAfter
  
  		// Check if expiry dates valid. Return if one or other is invalid.
  		// Otherwise rank by expiry date. Later is ranked higher.
  		c1Valid := helpers.ValidExpiry(c1)
  		c2Valid := helpers.ValidExpiry(c2)
  		if c1Valid && !c2Valid {
  			return 1
  		}
  		if !c1Valid && c2Valid {
  			return -1
  		}
  
  		r := compareTime(t1, t2)
  		// Return when we find rank difference.
  		if r != 0 {
  			return r
  		}
  	}
  	return 0
  }
docs: // CompareExpiryUbiquity ranks two certificate chains based on the exiry dates of intermediates and roots.
  // Certs expire later are ranked higher than ones expire earlier. The ranking between chains are determined by
  // the first pair of intermediates, scanned from the root level,  that ar ranked differently.