'Add/remove features and resolve dependencies between them'

def _finalize_features(self):

    for (name, feature) in self.features.items():
        enabled = self.feature_is_included(name)
        if (enabled or ((enabled is None) and feature.include_by_default())):
            feature.include_in(self)
            self._set_feature(name, 1)
    for (name, feature) in self.features.items():
        if (not self.feature_is_included(name)):
            feature.exclude_from(self)
            self._set_feature(name, 0)
