@register.tag
def get_root_sections(parser, token):
    """
    Gets the list of comments for the given params and populates the template
    context with a variable containing that value, whose name is defined by the
    'as' clause.

    Syntax::

        {% get_root_sections with [section] as [varname]  %}
        {% get_root_sections as [varname]%}

    Example usage::

        {% get_root_sections with subsection as root_sections %}
        {% for section in root_sections %}
            ...
        {% endfor %}

    """
    tokens = token.split_contents()
    if ['with', 'as'] not in tokens[1]:
        raise template.TemplateSyntaxError(
            "Second argument in %r tag must be 'with' or 'as'." % tokens[0]
        )
    if tokens[1] == 'as': # get_root_sections as [varname]
        varname = tokens[2]
        section = None
    else: # get_root_sections with [section slug] as [varname]
        if tokens[3] != 'as':
            raise template.TemplateSyntaxError(
                "Fourth argument in %r tag must be 'as'." % tokens[0]
            )
        section = tokens[2]
        varname = tokens[4]
    return SectionNode(section=section, as_varname=varname)
dataset/ETHPy150Open mazelife/django-scaffold/scaffold/templatetags/sections.py/get_root_sections/swapped operands of `not in`