def save_result(app, task):
    traceback = 'Some traceback'
    if (task['state'] == states.SUCCESS):
        app.backend.mark_as_done(task['id'], task['result'])
    elif (task['state'] == states.RETRY):
        app.backend.mark_as_retry(task['id'], task['result'], traceback=traceback)
    else:
        app.backend.mark_as_failure(task['id'], task['result'], traceback=traceback)
def save_result(app, task):
    traceback = 'Some traceback'
    if (task['state'] == states.SUCCESS):
        app.backend.mark_as_done(task['id'], task['result'])
    elif (task['state'] == states.RETRY):
        app.backend.mark_as_retry(task['id'], task['result'], traceback=traceback)
    else:
        app.backend.mark_as_failure(task['id'], task['result'], traceback=traceback)