code: def _add_or_update_vars(self):
          
          # Create the hosts extra inventory source (only if not empty)
          hosts_file = os.path.join(self.inventory_directory, 'hosts')
          if self.hosts:
              util.write_file(hosts_file, util.safe_dump(self.hosts))
          # Create the host_vars and group_vars directories
          for target in ['host_vars', 'group_vars']:
              if target == 'host_vars':
                  vars_target = copy.deepcopy(self.host_vars)
                  for instance_name, _ in self.host_vars.items():
                      if instance_name == 'localhost':
                          instance_key = instance_name
                      else:
                          instance_key = instance_name
  
                      vars_target[instance_key] = vars_target.pop(instance_name)
  
              elif target == 'group_vars':
                  vars_target = self.group_vars
  
              if vars_target:
                  target_vars_directory = os.path.join(self.inventory_directory,
                                                       target)
  
                  if not os.path.isdir(util.abs_path(target_vars_directory)):
                      os.mkdir(util.abs_path(target_vars_directory))
  
                  for target in vars_target.keys():
                      target_var_content = vars_target[target]
                      path = os.path.join(
                          util.abs_path(target_vars_directory), target)
                      util.write_file(path, util.safe_dump(target_var_content))
docs: Creates host and/or group vars and returns None.
  
          :returns: None