private void pruneNonMatching(Element parent, List<Element> children) {
        Iterator<Element> elemIt = children.iterator();
        while (elemIt.hasNext()) {
            Element child = elemIt.next();
            if ( ! matches(getInstances(child), getEnvironments(child), getRegions(child), getClouds(child), getTags(child))) {
                parent.removeChild(child);
                elemIt.remove();
            }
        }
    }
Prune elements that are not matching our environment and region.
config-application-package/src/main/java/com/yahoo/config/application/OverrideProcessor.java