def METHOD_NAME(log_level='INFO', profiling=_default_profiling):
    """
    Convenience decorator primarily useful for writing discardable test
    scripts.
    In the master process, when `func` is defined in the :mod:`__main__`
    module, arranges for `func(router)` to be invoked immediately, with
    :py:class:`mitogen.master.Router` construction and destruction handled just
    as in :py:func:`mitogen.utils.run_with_router`. In slaves, this function
    does nothing.
    :param str log_level:
        Logging package level to configure via
        :py:func:`mitogen.utils.log_to_file`.
    :param bool profiling:
        If :py:data:`True`, equivalent to setting
        :py:attr:`mitogen.master.Router.profiling` prior to router
        construction. This causes ``/tmp`` files to be created everywhere at
        the end of a successful run with :py:mod:`cProfile` output for every
        thread.
    Example:
    ::
        import mitogen
        import requests
        def get_url(url):
            return requests.get(url).text
        @mitogen.main()
        def main(router):
            z = router.ssh(hostname='k3')
            print(z.call(get_url, 'https://example.org/')))))
    """
    def wrapper(func):
        if func.__module__ != '__main__':
            return func
        import mitogen.parent
        import mitogen.utils
        if profiling:
            mitogen.core.enable_profiling()
            mitogen.master.Router.profiling = profiling
        mitogen.utils.log_to_file(level=log_level)
        return mitogen.core._profile_hook(
            'app.main',
            mitogen.utils.run_with_router,
            func,
        )
    return wrapper