def _MakeGroupFromRootSection(root_section, undefined_str):
    """Construct a dictinary { template name -> Template() instance }

  Args:
    root_section: _Section instance -- root of the original parse tree
  """
    group = {}
    for statement in root_section.Statements():
        if isinstance(statement, six.string_types):
            continue
        func, args = statement
        # here the function acts as ID for the block type
        if func is _DoDef and isinstance(args, _Section):
            section = args
            # Construct a Template instance from a this _Section subtree
            t = Template._FromSection(section, group, undefined_str)
            group[section.section_name] = t
    return group
Construct a dictinary { template name -> Template() instance }

  Args:
    root_section: _Section instance -- root of the original parse tree