code: def visit_Extends(self, node, frame):
          
          if not frame.toplevel:
              self.fail('cannot use extend from a non top-level scope',
                        node.lineno)
  
          # if the number of extends statements in general is zero so
          # far, we don't have to add a check if something extended
          # the template before this one.
          if self.extends_so_far > 0:
  
              # if we have a known extends we just add a template runtime
              # error into the generated code.  We could catch that at compile
              # time too, but i welcome it not to confuse users by throwing the
              # same error at different times just "because we can".
              if not self.has_known_extends:
                  self.writeline('if parent_template is not None:')
                  self.indent()
              self.writeline('raise TemplateRuntimeError(%r)' %
                             'extended multiple times')
  
              # if we have a known extends already we don't need that code here
              # as we know that the template execution will end here.
              if self.has_known_extends:
                  raise CompilerExit()
              else:
                  self.outdent()
  
          self.writeline('parent_template = environment.get_template(', node)
          self.visit(node.template, frame)
          self.write(', %r)' % self.name)
          self.writeline('for name, parent_block in parent_template.'
                         'blocks.%s():' % dict_item_iter)
          self.indent()
          self.writeline('context.blocks.setdefault(name, []).'
                         'append(parent_block)')
          self.outdent()
  
          # if this extends statement was in the root level we can take
          # advantage of that information and simplify the generated code
          # in the top level from this point onwards
          if frame.rootlevel:
              self.has_known_extends = True
  
          # and now we have one more
          self.extends_so_far += 1
docs: Calls the extender.