code: func newRuleImpl(impl starlark.Callable, defaults *starlark.Dict) (*ruleImpl, error) {
  	pairs := defaults.Items()
  	for _, pair := range pairs {
  		k, v := pair[0], pair[1]
  		if _, ok := k.(starlark.String); !ok {
  			return nil, fmt.Errorf("lucicfg.rule: keys in \"defaults\" must be strings")
  		}
  		if !isNamedStruct(v, "lucicfg.var") {
  			return nil, fmt.Errorf("lucicfg.rule: values in \"defaults\" must be lucicfg.var")
  		}
  	}
  	return &ruleImpl{
  		Callable: impl,
  		defaults: starlarkstruct.FromKeywords(starlark.String("lucicfg.rule.defaults"), pairs),
  	}, nil
  }
docs: // newRuleImpl construct a new rule if arguments pass the validation.