docs: def save_configure(self,
                         repo=None,
                         name=None,
                         groups=None,
                         config_val='',
                         from_registry=False,
                         main_cfg=False,
                         instances=1):
          """
          Save changes made to vent.template through npyscreen to the template
          and to plugin_manifest
          """
          def template_to_manifest(vent_template, manifest, tool, instances):
              """
              Helper function to transfer information from vent.template
              to plugin_manifest
              """
              sections = vent_template.sections()
              if sections[0]:
                  for section in sections[1]:
                      section_dict = {}
                      if section == 'settings':
                          section_dict.update({'instances': str(instances)})
                      options = vent_template.options(section)
                      if options[0]:
                          for option in options[1]:
                              option_name = option
                              if option == 'name':
                                  option_name = 'link_name'
                              opt_val = vent_template.option(section,
                                                             option)[1]
                              section_dict[option_name] = opt_val
                      if section_dict:
                          manifest.set_option(tool, section,
                                              json.dumps(section_dict))
                      elif manifest.option(tool, section)[0]:
                          manifest.del_option(tool, section)
  
          constraints = locals()
          del constraints['config_val']
          del constraints['from_registry']
          del constraints['main_cfg']
          del constraints['instances']
          del constraints['template_to_manifest']
          status = (True, None)
          fd = None
          # ensure instances is an int and remove instances from config_val to
          # ensure correct info
          instances = int(instances)
          config_val = re.sub(r'instances\ *=\ *\d+\n', '', config_val)
          api_system = System()
          manifest = api_system.manifest
          if not main_cfg:
              if not from_registry:
                  # creating new instances
                  if instances > 1:
                      fd, template_path = tempfile.mkstemp(suffix='.template')
                      # scrub name for clean section name
                      if re.search(r'\d+$', name):
                          name = re.sub(r'\d+$', '', name)
                      t_identifier = {'name': name,
                                      'branch': branch,
                                      'version': version}
                      result = Template(manifest).constrain_opts(
                          t_identifier, [])
                      tools = result[0]
                      tool = list(tools.keys())[0]
                  else:
                      options = ['path', 'multi_tool', 'name']
                      tools, _ = Template(manifest).constrain_opts(
                          constraints, options)
                      # only one tool in tools because perform this function for
                      # every tool
                      if tools:
                          tool = list(tools.keys())[0]
                          if ('multi_tool' in tools[tool] and
                                  tools[tool]['multi_tool'] == 'yes'):
                              name = tools[tool]['name']
                              if name == 'unspecified':
                                  name = 'vent'
                              template_path = join(tools[tool]['path'],
                                                   name+'.template')
                          else:
                              template_path = join(tools[tool]['path'],
                                                   'vent.template')
                      else:
                          status = (False, "Couldn't save configuration")
              else:
                  fd, template_path = tempfile.mkstemp(suffix='.template')
                  options = ['namespace']
                  constraints.update({'type': 'registry'})
                  tools, _ = Template(manifest).constrain_opts(constraints,
                                                               options)
                  if tools:
                      tool = list(tools.keys())[0]
                  else:
                      status = (False, "Couldn't save configuration")
              if status[0]:
                  try:
                      # save in vent.template
                      with open(template_path, 'w') as f:
                          f.write(config_val)
                      # save in plugin_manifest
                      vent_template = Template(template_path)
                      manifest = Template(manifest)
                      if instances > 1:
                          # add instances as needed
                          for i in range(1, instances + 1):
                              i_section = tool.rsplit(':', 2)
                              i_section[0] += str(i) if i != 1 else ''
                              i_section = ':'.join(i_section)
                              if not manifest.section(i_section)[0]:
                                  manifest.add_section(i_section)
                                  for val_pair in manifest.section(tool)[1]:
                                      name = val_pair[0]
                                      val = val_pair[1]
                                      if name == 'name':
                                          val += str(i)
                                      elif name == 'last_updated':
                                          val = Timestamp()
                                      elif name == 'running':
                                          val = 'no'
                                      manifest.set_option(i_section, name, val)
                                  template_to_manifest(vent_template, manifest,
                                                       i_section, instances)
                              else:
                                  settings = manifest.option(i_section,
                                                             'settings')
                                  if settings[0]:
                                      settings_dict = json.loads(settings[1])
                                      settings_dict['instances'] = str(instances)
                                      manifest.set_option(i_section, 'settings',
                                                          json.dumps(
                                                              settings_dict))
                                  else:
                                      inst = str(instances)
                                      settings_dict = {'instances': inst}
                                      manifest.set_option(i_section, 'settings',
                                                          json.dumps(
                                                              settings_dict))
                      else:
                          try:
                              settings_str = manifest.option(tool, 'settings')[1]
                              settings_dict = json.loads(settings_str)
                              old_instances = int(settings_dict['instances'])
                          except Exception:
                              old_instances = 1
                          template_to_manifest(vent_template, manifest,
                                               tool, old_instances)
                      manifest.write_config()
                      status = (True, manifest)
                  except Exception as e:  # pragma: no cover
                      self.logger.error('save_configure error: ' + str(e))
                      status = (False, str(e))
              # close os file handle and remove temp file
              if from_registry or instances > 1:
                  try:
                      close(fd)
                      remove(template_path)
                  except Exception as e:  # pragma: no cover
                      self.logger.error('save_configure error: ' + str(e))
          else:
              with open(self.vent_config, 'w') as f:
                  f.write(config_val)
          return status