public static XmlElement coerceToXmlElement(Stella_Object regiontag) {
    { Surrogate testValue000 = Stella_Object.safePrimaryType(regiontag);

      if (Surrogate.subtypeOfSymbolP(testValue000)) {
        { Symbol regiontag000 = ((Symbol)(regiontag));

          return (Stella.makeXmlElement(regiontag000.symbolName, "", null));
        }
      }
      else if (Surrogate.subtypeOfP(testValue000, Stella.SGT_STELLA_XML_ELEMENT)) {
        { XmlElement regiontag000 = ((XmlElement)(regiontag));

          return (regiontag000);
        }
      }
      else if (Surrogate.subtypeOfStringP(testValue000)) {
        { StringWrapper regiontag000 = ((StringWrapper)(regiontag));

          return (Stella.makeXmlElement(regiontag000.wrapperValue, "", null));
        }
      }
      else if (testValue000 == Stella.SGT_STELLA_CONS) {
        { Cons regiontag000 = ((Cons)(regiontag));

          if (regiontag000.rest == Stella.NIL) {
            return (Stella_Object.coerceToXmlElement(regiontag000.value));
          }
          else {
            { Stella_Object name = regiontag000.value;
              StringWrapper namespace = ((StringWrapper)(regiontag000.rest.value));

              { Surrogate testValue001 = Stella_Object.safePrimaryType(name);

                if (Surrogate.subtypeOfSymbolP(testValue001)) {
                  { Symbol name000 = ((Symbol)(name));

                    return (Stella.makeXmlElement(name000.symbolName, "", namespace.wrapperValue));
                  }
                }
                else if (Surrogate.subtypeOfP(testValue001, Stella.SGT_STELLA_XML_ELEMENT)) {
                  { XmlElement name000 = ((XmlElement)(name));

                    return (name000);
                  }
                }
                else if (Surrogate.subtypeOfStringP(testValue001)) {
                  { StringWrapper name000 = ((StringWrapper)(name));

                    return (Stella.makeXmlElement(name000.wrapperValue, "", namespace.wrapperValue));
                  }
                }
                else {
                  { OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

                    stream000.nativeStream.print("`" + testValue001 + "' is not a valid case option");
                    throw ((StellaException)(StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
                  }
                }
              }
            }
          }
        }
      }
      else {
        { OutputStringStream stream001 = OutputStringStream.newOutputStringStream();

          stream001.nativeStream.print("`" + testValue000 + "' is not a valid case option");
          throw ((StellaException)(StellaException.newStellaException(stream001.theStringReader()).fillInStackTrace()));
        }
      }
    }
  }