'Pops the topmost level for assignment tracking and updates the
context variables if necessary.'

def pop_assign_tracking(self, frame):

    vars = self._assign_stack.pop()
    if ((not frame.toplevel) or (not vars)):
        return
    public_names = [x for x in vars if (x[:1] != '_')]
    if (len(vars) == 1):
        name = next(iter(vars))
        ref = frame.symbols.ref(name)
        self.writeline(('context.vars[%r]    =    %s' % (name, ref)))
    else:
        self.writeline('context.vars.update({')
        for (idx, name) in enumerate(vars):
            if idx:
                self.write(',    ')
            ref = frame.symbols.ref(name)
            self.write(('%r:    %s' % (name, ref)))
        self.write('})')
    if public_names:
        if (len(public_names) == 1):
            self.writeline(('context.exported_vars.add(%r)' % public_names[0]))
        else:
            self.writeline(('context.exported_vars.update((%s))' % ',    '.join(imap(repr, public_names))))
