public static Stella_Object lookupQueryOption(Stella_Object queryoroptions, Keyword key) {
    { PropertyList options = null;

      { Surrogate testValue000 = Stella_Object.safePrimaryType(queryoroptions);

        if (Surrogate.subtypeOfP(testValue000, Logic.SGT_STELLA_PROPERTY_LIST)) {
          { PropertyList queryoroptions000 = ((PropertyList)(queryoroptions));

            options = queryoroptions000;
          }
        }
        else if (Surrogate.subtypeOfP(testValue000, Logic.SGT_LOGIC_QUERY_ITERATOR)) {
          { QueryIterator queryoroptions000 = ((QueryIterator)(queryoroptions));

            options = queryoroptions000.options;
          }
        }
        else {
          { OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

            stream000.nativeStream.print("`" + testValue000 + "' is not a valid case option");
            throw ((StellaException)(StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
          }
        }
      }
      return (options.lookup(key));
    }
  }