'Handle object de-nesting after content
If this class is a nestable object, removing the last nested class prefix
ends further nesting in the object.
If this class is not a nestable object, the list of classes should not
be altered as we didn\'t affect the nesting levels in
:py:meth:`before_content`.'

def after_content(self):

    classes = self.env.ref_context.setdefault('py:classes', [])
    if self.allow_nesting:
        try:
            classes.pop()
        except IndexError:
            pass
    self.env.ref_context['py:class'] = (classes[(-1)] if (len(classes) > 0) else None)
