def _root_block(block):
    """
    Looks up the root of the stack of blocks containing the given ``block``.

    Example
    -------

    Parameters
    ----------
    block : Block
        The block of interest for which the root block will be obtained.

    Returns
    -------
    Block
        The block at the root of the block stack containing ``block``.
    """
    if not block:
        return block
    while block.logical_parent:
        block = block.logical_parent
    return block
