docs: def load_template(name=None):
      """Loads a template of the specified name.
  
      Templates are placed in the <template_dir> directory in YAML format with
      a .yaml extension.
  
      If no name is specified then the function will return the default
      template (<template_dir>/default.yaml) if it exists.
      
      :param name: The name of the template to load.
      :type name: str or None (default)
  
      """
      if name is None:
          name = "default"
  
      logger.info("Loading template with name %s", name)
      try:
          template_file = open("%s/%s.yaml" % (template_path, name))
      except IOError:
          raise TemplateNotFoundError
  
      template = yaml.safe_load(template_file)
      template_file.close()
      if "extends" in template:
          logger.debug("Merging %s with %s", name, template["extends"])
          template = _merge(load_template(template["extends"]), template)
  
      return template