def parse_token_contents(parser, token):
 bits = token.split_contents()
 tag = bits.pop(0)
 args = []
 kwargs = {}
 asvar = None
 if ((len(bits) >= 2) and (bits[(-2)] == u'as')):
  asvar = bits[(-1)]
  bits = bits[:(-2)]
 if len(bits):
  for bit in bits:
   match = kwarg_re.match(bit)
   if (not match):
    raise TemplateSyntaxError(u'Malformed arguments to tag "{}"'.format(tag))
   (name, value) = match.groups()
   if name:
    kwargs[name] = parser.compile_filter(value)
   else:
    args.append(parser.compile_filter(value))
 return {u'tag': tag, u'args': args, u'kwargs': kwargs, u'asvar': asvar}

def parse_token_contents ( parser , token ) : bits = token . split_contents ( ) tag = bits . pop ( 0 ) args = [ ] kwargs = { } asvar = None if ( ( len ( bits ) >= 2 ) and ( bits [ ( - 2 ) ] == u'as' ) ) : asvar = bits [ ( - 1 ) ] bits = bits [ : ( - 2 ) ] if len ( bits ) : for bit in bits : match = kwarg_re . match ( bit ) if ( not match ) : raise TemplateSyntaxError ( u'Malformed arguments to tag "{}"' . format ( tag ) ) ( name , value ) = match . groups ( ) if name : kwargs [ name ] = parser . compile_filter ( value ) else : args . append ( parser . compile_filter ( value ) ) return { u'tag' : tag , u'args' : args , u'kwargs' : kwargs , u'asvar' : asvar }
parse template tag contents .