@register.tag(name="loadmacros")
def do_loadmacros(parser, token):
    """ The function taking a parsed tag and returning
    a LoadMacrosNode object, while also loading the macros
    into the page.
    """
    try:
        tag_name, filename = token.split_contents()
    except __HOLE__:
        raise template.TemplateSyntaxError(
            "'{0}' tag requires exactly one argument (filename)".format(
                token.contents.split()[0]))
    if filename[0] in ('"', "'") and filename[-1] == filename[0]:
        filename = filename[1:-1]
    else:
        raise template.TemplateSyntaxError(
            "Malformed argument to the {0} template tag."
            " Argument must be in quotes.".format(tag_name)
        )
    t = get_template(filename)
    try:
        # Works for Django 1.8
        nodelist = t.template.nodelist
    except AttributeError:
        # Works for Django < 1.8
        nodelist = t.nodelist
    macros = nodelist.get_nodes_by_type(DefineMacroNode)
    # make sure the _macros attribute dictionary is instantiated
    # on the parser, then add the macros to it.
    _setup_macros_dict(parser)
    for macro in macros:
        parser._macros[macro.name] = macro
    # pass macros to LoadMacrosNode so that it can
    # resolve the macros template variable kwargs on render
    return LoadMacrosNode(macros)
dataset/ETHPy150Open nalourie/django-macros/build/lib/macros/templatetags/macros.py/do_loadmacros