def compare_and_swap(var, compare, new):
    "If `var` is equal to `compare`, set it to `new`."
    if assign('v', inspect.stack()[1][0].f_globals)[var] == compare:
        v[var] = new
If `var` is equal to `compare`, set it to `new`.
scripts/lcb_runner/pyext/pyext-0.7/pyext.py