code: public static List<KeyedStateHandle> getKeyedStateHandles(
  		Collection<? extends KeyedStateHandle> keyedStateHandles,
  		KeyGroupRange subtaskKeyGroupRange) {
  
  		List<KeyedStateHandle> subtaskKeyedStateHandles = new ArrayList<>(keyedStateHandles.size());
  
  		for (KeyedStateHandle keyedStateHandle : keyedStateHandles) {
  			KeyedStateHandle intersectedKeyedStateHandle = keyedStateHandle.getIntersection(subtaskKeyGroupRange);
  
  			if (intersectedKeyedStateHandle != null) {
  				subtaskKeyedStateHandles.add(intersectedKeyedStateHandle);
  			}
  		}
  
  		return subtaskKeyedStateHandles;
  	}
docs: Determine the subset of {@link KeyGroupsStateHandle KeyGroupsStateHandles} with correct
  key group index for the given subtask {@link KeyGroupRange}.
  
  <p>This is publicly visible to be used in tests.