@register.tag
def get_top_level_categories(parser, token):
    """
    Retrieves an alphabetical list of all the categories that have no parents.

    Syntax::

        {% get_top_level_categories [using "app.Model"] as categories %}

    Returns an list of categories [<category>, <category>, <category, ...]
    """
    bits = token.split_contents()
    usage = 'Usage: {%% %s [using "app.Model"] as <variable> %%}' % bits[0]
    if len(bits) == 3:
        if bits[1] != 'as':
            raise template.TemplateSyntaxError(usage)
        varname = bits[2]
        model = "categories.category"
    elif len(bits) == 5:
        if ('as', 'using') not in bits[1] and bits[3] not in ('as', 'using'):
            raise template.TemplateSyntaxError(usage)
        if bits[1] == 'using':
            model = bits[2].strip("'\"")
            varname = bits[4].strip("'\"")
        else:
            model = bits[4].strip("'\"")
            varname = bits[2].strip("'\"")

    return TopLevelCategoriesNode(varname, model)
dataset/ETHPy150Open callowayproject/django-categories/categories/templatetags/category_tags.py/get_top_level_categories/swapped operands of `not in`