@Nullable
 public static <T> T cast(@NotNull Class<T> type, UnnamedConfigurable configurable) {
   if (configurable instanceof ConfigurableWrapper) {
     ConfigurableWrapper wrapper = (ConfigurableWrapper) configurable;
     if (wrapper.myConfigurable == null) {
       Class<?> configurableType = wrapper.getExtensionPoint().getConfigurableType();
       if (configurableType != null) {
         if (!type.isAssignableFrom(configurableType)) {
           return null; // do not create configurable that cannot be cast to the specified type
         }
       } else if (type == Configurable.Assistant.class || type == OptionalConfigurable.class) {
         return null; // do not create configurable from ConfigurableProvider which replaces
                      // OptionalConfigurable
       }
     }
     configurable = wrapper.getConfigurable();
   }
   return type.isInstance(configurable) ? type.cast(configurable) : null;
 }
 @Override
 protected Configurable prepare(Configurable key) {
   long time = System.currentTimeMillis();
   try {
     ConfigurableWrapper.cast(
         Configurable.class, key); // create wrapped configurable on a pooled thread
   } catch (Exception unexpected) {
     LOG.error("cannot prepare configurable", unexpected);
   } finally {
     warn(key, "prepare", time);
   }
   return key;
 }