public static PropertyList vetOptions(Stella_Object plist, Cons legaloptions) {
    { PropertyList propertylist = null;

      { Surrogate testValue000 = Stella_Object.safePrimaryType(plist);

        if (Surrogate.subtypeOfP(testValue000, Stella.SGT_STELLA_PROPERTY_LIST)) {
          { PropertyList plist000 = ((PropertyList)(plist));

            propertylist = plist000;
          }
        }
        else if (testValue000 == Stella.SGT_STELLA_CONS) {
          { Cons plist000 = ((Cons)(plist));

            { PropertyList self000 = PropertyList.newPropertyList();

              self000.thePlist = plist000;
              propertylist = self000;
            }
          }
        }
        else if (Surrogate.subtypeOfP(testValue000, Stella.SGT_STELLA_LIST)) {
          { List plist000 = ((List)(plist));

            { PropertyList self001 = PropertyList.newPropertyList();

              self001.thePlist = plist000.theConsList;
              propertylist = self001;
            }
          }
        }
        else {
          Stella.STANDARD_WARNING.nativeStream.println("Warning: Illegal argument passed to 'vet-options'");
          return (PropertyList.newPropertyList());
        }
      }
      { Stella_Object key = null;
        Stella_Object value = null;
        Cons iter000 = propertylist.thePlist;

        for (;!(iter000 == Stella.NIL); iter000 = iter000.rest.rest) {
          key = iter000.value;
          value = iter000.rest.value;
          if ((!Stella_Object.stellaObjectP(key)) ||
              ((!Stella_Object.keywordP(key)) ||
               ((legaloptions != null) &&
                (!legaloptions.memberP(key))))) {
            value = value;
            if (!Stella_Object.stellaObjectP(key)) {
              { PropertyList newplist = PropertyList.newPropertyList();

                { Stella_Object key000 = null;
                  Stella_Object value000 = null;
                  Cons iter001 = propertylist.thePlist;

                  for (;!(iter001 == Stella.NIL); iter001 = iter001.rest.rest) {
                    key000 = iter001.value;
                    value000 = iter001.rest.value;
                    newplist.insertAt(Stella_Object.stellify(key000), Stella_Object.stellify(value000));
                  }
                }
                propertylist.thePlist = newplist.thePlist;
              }
              Stella_Object.vetOptions(propertylist, legaloptions);
              return (propertylist);
            }
            propertylist.removeAt(key);
            {
              System.out.println("Skipping illegal option: `" + key + "'");
              System.out.println();
            }
;
            if (Stella_Object.keywordP(key)) {
              {
                System.out.println("   Legal options are: `" + legaloptions + "'");
                System.out.println();
              }
;
            }
            else {
              System.out.println("   Option must be a keyword.");
            }
            Stella_Object.vetOptions(propertylist, legaloptions);
            return (propertylist);
          }
        }
      }
      return (propertylist);
    }
  }