code: func NodeSelectorRequirementsAsFieldSelector(nsm []core.NodeSelectorRequirement) (fields.Selector, error) {
  	if len(nsm) == 0 {
  		return fields.Nothing(), nil
  	}
  
  	selectors := []fields.Selector{}
  	for _, expr := range nsm {
  		switch expr.Operator {
  		case core.NodeSelectorOpIn:
  			if len(expr.Values) != 1 {
  				return nil, fmt.Errorf("unexpected number of value (%d) for node field selector operator %q",
  					len(expr.Values), expr.Operator)
  			}
  			selectors = append(selectors, fields.OneTermEqualSelector(expr.Key, expr.Values[0]))
  
  		case core.NodeSelectorOpNotIn:
  			if len(expr.Values) != 1 {
  				return nil, fmt.Errorf("unexpected number of value (%d) for node field selector operator %q",
  					len(expr.Values), expr.Operator)
  			}
  			selectors = append(selectors, fields.OneTermNotEqualSelector(expr.Key, expr.Values[0]))
  
  		default:
  			return nil, fmt.Errorf("%q is not a valid node field selector operator", expr.Operator)
  		}
  	}
  
  	return fields.AndSelectors(selectors...), nil
  }
docs: // NodeSelectorRequirementsAsFieldSelector converts the []NodeSelectorRequirement core type into a struct that implements
  // fields.Selector.