code: func ensureValidConditions(t Type, conditions []*Condition) error {
  	// check type sanity
  	for _, r := range conditions {
  		if err := ensureTypeMatch(t, r.Value); err != nil {
  			return errors.Wrap(err, "invalid condition")
  		}
  	}
  
  	switch {
  	case len(conditions) == 1:
  		return nil // single condition is always valid
  	case len(conditions) > 2:
  		return errors.Errorf("conditions: %v, rules: %s", conditions, conditionsRule)
  	}
  
  	r0 := conditions[0]
  	r1 := conditions[1]
  	// sort conditions according to operators so we have few cases to handle
  	if r0.Op >= r1.Op {
  		r0, r1 = r1, r0
  	}
  
  	op0 := r0.Op
  	v0 := r0.Value
  	op1 := r1.Op
  	v1 := r1.Value
  
  	switch {
  	//  v1 < fv < v0, v1 <= fv < v0, v1 < fv <= v0    ===> v0 > v1
  	case op0 == Lt && op1 == Gt, op0 == Lt && op1 == GtOrEq, op0 == LtOrEq && op1 == Gt:
  		if compare(t, v0, v1) <= 0 {
  			return errors.Errorf("invalid range: %v", conditions)
  		}
  		// v1 <= fv <= v0   ===> v0 >= v1
  	case op0 == LtOrEq && op1 == GtOrEq:
  		if compare(t, v0, v1) < 0 {
  			return errors.Errorf("invalid range: %v", conditions)
  		}
  	default: // invalid combination of operators
  		return errors.Errorf("unsupported conditions: %v, rules: %s", conditions, conditionsRule)
  
  	}
  
  	return nil
  }
docs: // Start with simple rules as specified in `conditionsRule` above.
  // Hence, the length of valid conditions slice is either one or two (won't be called if zero length).