public static ApiVersion toApiVersion(ApiKeys apiKey) {
        return new ApiVersion()
            .setApiKey(apiKey.id)
            .setMinVersion(apiKey.oldestVersion())
            .setMaxVersion(apiKey.latestVersion());
    }
Find the common range of supported API versions between the locally
known range and that of another set.

@param listenerType the listener type which constrains the set of exposed APIs
@param minRecordVersion min inter broker magic
@param activeControllerApiVersions controller ApiVersions
@param enableUnstableLastVersion whether unstable versions should be advertised or not
@param clientTelemetryEnabled whether client telemetry is enabled or not
@return commonly agreed ApiVersion collection
clients/src/main/java/org/apache/kafka/common/requests/ApiVersionsResponse.java