human
Complete this python program:
def asynchronous(method):
assistant
#Here is the Python program you requested.

    """Wrap request handler methods with this if they are asynchronous.
    This decorator is unnecessary if the method is also decorated with
    ``@gen.coroutine`` (it is legal but unnecessary to use the two
    decorators together, in which case ``@asynchronous`` must be
    first).
    This decorator should only be applied to the :ref:`HTTP verb
    methods <verbs>`; its behavior is undefined for any other method.
    This decorator does not *make* a method asynchronous; it tells
    the framework that the method *is* asynchronous.  For this decorator
    to be useful the method must (at least sometimes) do something
    asynchronous.
    If this decorator is given, the response is not finished when the
    method returns. It is up to the request handler to call
    `self.finish() <RequestHandler.finish>` to finish the HTTP
    request. Without this decorator, the request is automatically
    finished when the ``get()`` or ``post()`` method returns. Example::
    class MyRequestHandler(web.RequestHandler):
    @web.asynchronous
    def get(self):
    http = httpclient.AsyncHTTPClient()
    http.fetch("http://friendfeed.com/", self._on_download)
    def _on_download(self, response):
    self.write("Downloaded!")
    self.finish()
    .. versionadded:: 3.1
    The ability to use ``@gen.coroutine`` without ``@asynchronous``.
    """
    from tornado.ioloop import IOLoop
    @functools.wraps(method)
    def wrapper(self, *args, **kwargs):
        if self.application._wsgi:
            raise Exception('@asynchronous    is    not    supported    for    WSGI    apps')
        self._auto_finish = False
        with stack_context.ExceptionStackContext(self._stack_context_handle_exception):
            result = method(self, *args, **kwargs)
            if isinstance(result, Future):
                def future_complete(f):
                    f.result()
                    if (not self._finished):
                        self.finish()
                IOLoop.current().add_future(result, future_complete)
            return result
    return wrapper