public static MethodSlot lookupOptionHandler(StorageSlot slot) {
    { Symbol handlername = ((Symbol)(KeyValueList.dynamicSlotValue(slot.dynamicSlots, Stella.SYM_STELLA_SLOT_OPTION_HANDLER, null)));
      MethodSlot handler = null;

      if (handlername == null) {
        if (Stella.$DEFAULT_OPTION_HANDLER$ != null) {
          return (Stella.$DEFAULT_OPTION_HANDLER$);
        }
        else {
          return (Symbol.lookupFunction(Stella.SYM_STELLA_DEFAULT_OPTION_HANDLER));
        }
      }
      handler = Symbol.lookupFunction(handlername);
      if ((((Integer)(Stella.$SAFETY$.get())).intValue() >= 2) &&
          ((handler != null) &&
           ((!(handlername == Stella.SYM_STELLA_DEFAULT_OPTION_HANDLER)) &&
            (!handler.conformingSignaturesP(Stella.$DEFAULT_OPTION_HANDLER$))))) {
        { OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

          stream000.nativeStream.print("The signature of slot option handler `" + handlername + "' does not conform to that of 'default-option-handler'.");
          throw ((StellaException)(StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
        }
      }
      return (handler);
    }
  }