code: def index_template(self, tpl):
          
          objcls = self.inner_class.my_type
          name = getattr(tpl, 'name', '')
          if not name:
              mesg = "a %s template has been defined without name, from: %s" % \
                     (objcls, tpl.imported_from)
              tpl.add_error(mesg)
          elif name in self.name_to_template:
              tpl = self.manage_conflict(tpl, name)
          self.name_to_template[name] = tpl
          logger.debug("Indexed a %s template: %s, uses: %s",
                       tpl.my_type, name, getattr(tpl, 'use', 'Nothing'))
          return tpl
docs: Indexes a template by `name` into the `name_to_template` dictionary.
  
          :param tpl: The template to index
          :type tpl: alignak.objects.item.Item
          :return: None