def METHOD_NAME(self, context):
    """Run a block with a temporary output context"""
    orig_context = self.context
    self.context = context
    try:
        yield
    finally:
        self.context = orig_context