code: func (a *HorizontalController) scaleForResourceMappings(namespace, name string, mappings []*apimeta.RESTMapping) (*autoscalingv1.Scale, schema.GroupResource, error) {
  	var firstErr error
  	for i, mapping := range mappings {
  		targetGR := mapping.Resource.GroupResource()
  		scale, err := a.scaleNamespacer.Scales(namespace).Get(targetGR, name)
  		if err == nil {
  			return scale, targetGR, nil
  		}
  
  		// if this is the first error, remember it,
  		// then go on and try other mappings until we find a good one
  		if i == 0 {
  			firstErr = err
  		}
  	}
  
  	// make sure we handle an empty set of mappings
  	if firstErr == nil {
  		firstErr = fmt.Errorf("unrecognized resource")
  	}
  
  	return nil, schema.GroupResource{}, firstErr
  }
docs: // scaleForResourceMappings attempts to fetch the scale for the
  // resource with the given name and namespace, trying each RESTMapping
  // in turn until a working one is found.  If none work, the first error
  // is returned.  It returns both the scale, as well as the group-resource from
  // the working mapping.