def METHOD_NAME():
    logging.basicConfig(level=logging.INFO)
    try:
        path = os.path.dirname(__file__)
    except NameError:
        # The "__file__" name is not always available, for example
        # when this module is run from PythonWin.  In this case we
        # simply use the current working directory.
        path = os.getcwd()
        __file__ = os.path.join(path, "wsr_module_loader_plus.py")
    # Initialize and connect the engine.
    # Set any configuration options here as keyword arguments.
    engine = get_engine("sapi5inproc")
    engine.connect()
    # Load grammars.
    load_sleep_wake_grammar(True)
    directory = CommandModuleDirectory(path, excludes=[__file__])
    directory.load()
    # Define recognition callback functions.
    def on_begin():
        print("Speech start detected.")
    def on_recognition(words):
        message = u"Recognized: %s" % u" ".join(words)
        # This only seems to be an issue with Python 2.7 on Windows.
        if six.PY2:
            encoding = sys.stdout.encoding or "ascii"
            message = message.encode(encoding, errors='replace')
        print(message)
    def on_failure():
        print("Sorry, what was that?")
    # Start the engine's main recognition loop
    try:
        print("Listening...")
        engine.do_recognition(on_begin, on_recognition, on_failure)
    except KeyboardInterrupt:
        pass