<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def logout(anchore_config):
 """ Log out of Anchore service """

    ecode = 0
    try:
        aa = contexts['anchore_auth']
        if aa:
            anchore_auth.anchore_auth_invalidate(aa)
            if 'auth_file' in aa:
                os.remove(aa['auth_file'])
        print "Logout successful."
    except Exception as err:
        anchore_print_err('operation failed')
        ecode = 1

    sys.exit(ecode)