code: 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] == "as":
          asvar = bits[-1]
          bits = bits[:-2]
      for bit in bits:
          match = kwarg_re.match(bit)
          if not match:
              raise TemplateSyntaxError('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 {"tag": tag, "args": args, "kwargs": kwargs, "asvar": asvar}
docs: Parse template tag contents