def do_include_extend(parser, token):
  """
  A tag to include a template with the ability to replace blocks like with
  'extends'. Use like:

  {% include_extend 'foo' %}
    {% block bar %}...{% endblock %}
  {% endinclude_extend %}

  This is supposed to be used when you want to override bits of a template but
  don't plan to reuse the version on any other page, so that the overhead of
  doing that is kept to a minimum, encouraging reuse.

  Parsing copied from django's do_extend.
  """
  bits = token.contents.split()
  if len(bits) != 2:
      raise template.TemplateSyntaxError, bits[0] % "'%s' takes one argument"
  parent_name, parent_name_expr = None, None
  if bits[1][0] in ('"', "'") and bits[1][-1] == bits[1][0]:
      parent_name = bits[1][1:-1]
  else:
      parent_name_expr = parser.compile_filter(bits[1])
  nodelist = parser.parse(('end' + bits[0],))
  parser.delete_first_token()
  return IncludeExtendNode(nodelist, parent_name, parent_name_expr)
dataset/ETHPy150Open CollabQ/CollabQ/common/templatetags/base.py/do_include_extend/swapped operands of `%`