public static void validateVersion(FeatureVersion feature, Map<String, Short> features) {
        Short metadataVersion = features.get(MetadataVersion.FEATURE_NAME);

        if (feature.featureLevel() >= 1 && (metadataVersion == null || metadataVersion < MetadataVersion.IBP_3_3_IV0.featureLevel()))
            throw new IllegalArgumentException(feature.featureName() + " could not be set to " + feature.featureLevel() +
                    " because it depends on metadata.version=4 (" + MetadataVersion.IBP_3_3_IV0 + ")");

        for (Map.Entry<String, Short> dependency: feature.dependencies().entrySet()) {
            Short featureLevel = features.get(dependency.getKey());

            if (featureLevel == null || featureLevel < dependency.getValue()) {
                throw new IllegalArgumentException(feature.featureName() + " could not be set to " + feature.featureLevel() +
                        " because it depends on " + dependency.getKey() + " level " + dependency.getValue());
            }
        }
    }
A method to validate the feature can be set. If a given feature relies on another feature, the dependencies should be
captured in {@link FeatureVersion#dependencies()}
<p>
For example, say feature X level x relies on feature Y level y:
if feature X >= x then throw an error if feature Y < y.

All feature levels above 0 require metadata.version=4 (IBP_3_3_IV0) in order to write the feature records to the cluster.

@param feature                   the feature we are validating
@param features                  the feature versions we have (or want to set)
@throws IllegalArgumentException if the feature is not valid
server-common/src/main/java/org/apache/kafka/server/common/Features.java