@register.tag
def templatetag(parser, token):
 bits = token.contents.split()
 if (len(bits) != 2):
  raise TemplateSyntaxError(u"'templatetag' statement takes one argument")
 tag = bits[1]
 if (tag not in TemplateTagNode.mapping):
  raise TemplateSyntaxError((u"Invalid templatetag argument: '%s'. Must be one of: %s" % (tag, list(TemplateTagNode.mapping))))
 return TemplateTagNode(tag)

@ register . tag def templatetag ( parser , token ) : bits = token . contents . split ( ) if ( len ( bits ) != 2 ) : raise TemplateSyntaxError ( u"'templatetag' statement takes one argument" ) tag = bits [ 1 ] if ( tag not in TemplateTagNode . mapping ) : raise TemplateSyntaxError ( ( u"Invalid templatetag argument: '%s'. Must be one of: %s" % ( tag , list ( TemplateTagNode . mapping ) ) ) ) return TemplateTagNode ( tag )
outputs one of the bits used to compose template tags .