code: public static <T> String apiVersion(T item, String apiVersion) {
      if (item instanceof HasMetadata && Utils.isNotNullOrEmpty(((HasMetadata) item).getApiVersion())) {
        return trimVersion(((HasMetadata) item).getApiVersion());
      } else if (apiVersion != null && !apiVersion.isEmpty()) {
        return trimVersion(apiVersion);
      }
      return null;
    }
docs: Returns the api version falling back to the items apiGroupVersion if not null.
  @param <T> type of parameter
  @param item item to be processed
  @param apiVersion apiVersion string
  @return returns api version