code: def mod_list(only_persist=False):
      '''
      Return a list of the loaded module names
  
      only_persist
          Only return the list of loaded persistent modules
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' kmod.mod_list
      '''
      mods = set()
      if only_persist:
          conf = _get_modules_conf()
          if os.path.exists(conf):
              try:
                  with salt.utils.files.fopen(conf, 'r') as modules_file:
                      for line in modules_file:
                          line = line.strip()
                          mod_name = _strip_module_name(line)
                          if not line.startswith('#') and mod_name:
                              mods.add(mod_name)
              except IOError:
                  log.error('kmod module could not open modules file at %s', conf)
      else:
          for mod in lsmod():
              mods.add(mod['module'])
      return sorted(list(mods)f mod_list(only_persist=False):
      '''
      Return a list of the loaded module names
  
      only_persist
          Only return the list of loaded persistent modules
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' kmod.mod_list
      '''
      mods = set()
      if only_persist:
          conf = _get_modules_conf()
          if os.path.exists(conf):
              try:
                  with salt.utils.files.fopen(conf, 'r') as modules_file:
                      for line in modules_file:
                          line = line.strip()
                          mod_name = _strip_module_name(line)
                          if not line.startswith('#') and mod_name:
                              mods.add(mod_name)
              except IOError:
                  log.error('kmod module could not open modules file at %s', conf)
      else:
          for mod in lsmod():
              mods.add(mod['module'])
      return sorted(list(mods))
docs: Return a list of the loaded module names
  
      only_persist
          Only return the list of loaded persistent modules
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' kmod.mod_list