public static Module coerceToModule(Stella_Object renamed_Object, boolean warnP) {
    if (renamed_Object == null) {
      return (((Module)(Stella.$MODULE$.get())));
    }
    if (Surrogate.subtypeOfP(Stella_Object.safePrimaryType(renamed_Object), Stella.SGT_STELLA_MODULE)) {
      { Module object000 = ((Module)(renamed_Object));

        return (object000);
      }
    }
    else {
      { String modulename = Stella_Object.coerceToModuleName(renamed_Object, warnP);

        if (modulename != null) {
          if (Stella.qualifiedStellaNameP(modulename)) {
            return (Stella.getStellaModule(modulename, warnP));
          }
          return (Stella.getStellaModule(modulename, warnP));
        }
        return (null);
      }
    }
  }