public static @Nullable <T> T cast(@NotNull Class<T> type, @Nullable UnnamedConfigurable configurable) {
    if (configurable instanceof ConfigurableWrapper wrapper) {
      if (wrapper.myConfigurable == null) {
        Class<?> configurableType = wrapper.getExtensionPoint().getConfigurableType();
        if (configurableType != null) {
          if (!type.isAssignableFrom(configurableType)) {
            // do not create configurable that cannot be cast to the specified type
            return null;
          }
        }
      }
      configurable = wrapper.getConfigurable();
    }
    return type.isInstance(configurable) ? type.cast(configurable) : null;
  }
public static @Nullable <T> T cast(@NotNull Class<T> type, @Nullable UnnamedConfigurable configurable)