code: func ActiveToSingleStates(active map[string][]UnitState) (map[string]UnitState, error) {
  	states := make(map[string]UnitState)
  	for name, us := range active {
  		if len(us) != 1 {
  			return nil, fmt.Errorf("unit %s running in multiple locations: %v", name, us)
  		}
  		states[name] = us[0]
  	}
  	return states, nil
  }
docs: // ActiveToSingleStates takes a map of active states (such as that returned by
  // WaitForNActiveUnits) and ensures that each unit has at most a single active
  // state. It returns a mapping of unit name to a single UnitState.