docs: def thumbnail(parser, token):
      """
      Creates a thumbnail of for an ImageField.
  
      To just output the absolute url to the thumbnail::
  
          {% thumbnail image 80x80 %}
  
      After the image path and dimensions, you can put any options::
  
          {% thumbnail image 80x80 force_ssl=True %}
  
      To put the thumbnail URL on the context instead of just rendering
      it, finish the tag with ``as [context_var_name]``::
  
          {% thumbnail image 80x80 as thumb %}
          <img src="{{thumb}}" />
      """
      args = token.split_contents()
      tag = args[0]
      # Check to see if we're setting to a context variable.
      if len(args) > 4 and args[-2] == 'as':
          context_name = args[-1]
          args = args[:-2]
      else:
          context_name = None
  
      if len(args) < 3:
          raise TemplateSyntaxError("Invalid syntax. Expected "
              "'{%% %s source size [option1 option2 ...] %%}' or "
              "'{%% %s source size [option1 option2 ...] as variable %%}'" %
              (tag, tag))
  
      # Get the source image path and requested size.
  
      source_var = args[1]
      # If the size argument was a correct static format, wrap it in quotes so
      # that it is compiled correctly.
      m = REGEXP_THUMB_SIZES.match(args[2])
      if m:
          args[2] = '"%s"' % args[2]
      size_var = args[2]
  
      # Get the options.
      args_list = split_args(args[3:]).items()
  
      # Check the options.
      opts = {}
      kwargs = {} # key,values here override settings and defaults
  
      for arg, value in args_list:
          value = value and parser.compile_filter(value)
          if arg in TAG_SETTINGS and value is not None:
              kwargs[str(arg)] = value
              continue
          else:
              raise TemplateSyntaxError("'%s' tag received a bad argument: "
                                        "'%s'" % (tag, arg))
      return ThumbnailNode(source_var, size_var, opts=opts,
                           context_name=context_name, **kwargs)