def get_block_dict(top_level_block):
    """Returns a dictionary of block names (str) to block contents (str) for all child blocks, as
    well as the original block itself.

    The block_dict argument is only used for recursive calls and should not 
    """
    block_stack = [top_level_block]
    block_dict = {}
    while block_stack:
        block = block_stack.pop()
        block_dict[block.name] = str(block)
        for segment in block.segments:
            if isinstance(segment, Block):
                block_stack.append(segment)
    return block_dict