'Helper function that allocate a temporary for a closure variable that
is assigned to.'

def _allocate_closure_temp(self, code, entry):

    if self.parent:
        return self.parent._allocate_closure_temp(code, entry)
    if (entry.cname in self.seen_closure_vars):
        return entry.cname
    cname = code.funcstate.allocate_temp(entry.type, True)
    self.seen_closure_vars.add(entry.cname)
    self.seen_closure_vars.add(cname)
    self.modified_entries.append((entry, entry.cname))
    code.putln(('%s    =    %s;' % (cname, entry.cname)))
    entry.cname = cname
