<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def terminate_app(app_id, is_finished=False):
 """ update app state to 'Terminated' """

    state = constant.STATE_APP_TERMINATED if is_finished else constant.STATE_APP_TERMINATING
    app_update_state(app_id, state)
    if is_finished:
        delete_app_info(app_id)