def METHOD_NAME(task):
    is_error = False
    if task.exception():
        result = task.exception()
        is_error = True
    else:
        result = task.result()
    # send results to the main loop
    self.main_loop.call_soon_threadsafe(to_main, result, is_error)
    # stopping the loop here ensures that the coroutine completed
    # and doesn't raise any "task not awaited" exceptions
    if stop_loop:
        self.background_loop.stop()