human
Complete this python program:
def completion(callback):
assistant
#Here is the Python code you requested.

    """Executes a task on completion of the called action.
    Example:
    Use as::
    from gluon.tools import completion
    @completion(lambda d: logging.info(repr(d)))
    def index():
    return dict(message=\hello\)
    It logs the output of the function every time input is called.
    The argument of completion is executed in a new thread.
    """
    def _completion(f):
        def __completion(*a, **b):
            d = None
            try:
                d = f(*a, **b)
                return d
            finally:
                thread.start_new_thread(callback, (d,))
        return __completion
    return _completion