def block_node(name, block, context):
    """A block of inheritable content."""
    block_stack = [(context, block)]
    child_context = context
    while '__child__' in child_context.meta:
        child_context = child_context.meta['__child__']
        block = child_context.meta['__blocks__'].get(name)
        if block:
            block_context = child_context
            block_stack.append((block_context, block))
    block_context, block = block_stack.pop()
    sub_context = block_context.sub_context(meta={'__parent_blocks__':
        block_stack})
    block._render_to_context(sub_context)
