@register.tag
def siteblock(parser, token):
    """Two notation types are acceptable:

        1. Two arguments:
           {% siteblock "myblock" %}
           Used to render "myblock" site block.
           
        2. Four arguments:
           {% siteblock "myblock" as myvar %}
           Used to put "myblock" site block into "myvar" template variable.
           
    """
    tokens = token.split_contents()
    tokens_num = len(tokens)

    if tokens_num not in (2, 4):
        raise template.TemplateSyntaxError(
            '%r tag requires two or four arguments. '
            'E.g.: {%% siteblock "myblock" %%} or {%% siteblock "myblock" as myvar %%}.' % tokens[0])

    block_alias = parser.compile_filter(tokens[1])
    as_var = None
    tokens = tokens[2:]
    if len(tokens) >= 2 and tokens[-2] == 'as':
        as_var = tokens[-1]

    return siteblockNode(block_alias, as_var)
dataset/ETHPy150Open idlesign/django-siteblocks/siteblocks/templatetags/siteblocks.py/siteblock/original