@register.tag
def repeat(parser, token):
    try:
        tag_name, block_name = token.split_contents()
    except ValueError:
        raise template.TemplateSyntaxError(
            '{0} tag takes only one argument'.format(
                token.contents.split()[0]))
    # try to fetch the stored block
    try:
        block_node = parser._repeated_blocks[block_name]
    except (__HOLE__, KeyError):
        raise template.TemplateSyntaxError(
            "No repeated block {0} tag was found before the {1} tag".format(
                block_name, tag_name))
    # return the block to be repeated
    return block_node
dataset/ETHPy150Open nalourie/django-macros/build/lib/macros/templatetags/repeatedblocks.py/repeat