'Adds a new post-rendering callback.
If the response has already been rendered,
invoke the callback immediately.'

def add_post_render_callback(self, callback):

    if self._is_rendered:
        callback(self)
    else:
        self._post_render_callbacks.append(callback)
