def generic_tag_compiler(params, defaults, name, node_class, parser, token):
 bits = token.split_contents()[1:]
 bmax = len(params)
 def_len = ((defaults and len(defaults)) or 0)
 bmin = (bmax - def_len)
 if ((len(bits) < bmin) or (len(bits) > bmax)):
  if (bmin == bmax):
   message = ('%s takes %s arguments' % (name, bmin))
  else:
   message = ('%s takes between %s and %s arguments' % (name, bmin, bmax))
  raise TemplateSyntaxError(message)
 return node_class(bits)

def generic_tag_compiler ( params , defaults , name , node_class , parser , token ) : bits = token . split_contents ( ) [ 1 : ] bmax = len ( params ) def_len = ( ( defaults and len ( defaults ) ) or 0 ) bmin = ( bmax - def_len ) if ( ( len ( bits ) < bmin ) or ( len ( bits ) > bmax ) ) : if ( bmin == bmax ) : message = ( '%s takes %s arguments' % ( name , bmin ) ) else : message = ( '%s takes between %s and %s arguments' % ( name , bmin , bmax ) ) raise TemplateSyntaxError ( message ) return node_class ( bits )
returns a template .