docs: def autoremove(list_only=False, purge=False):
      '''
      .. versionadded:: 2015.5.0
  
      Remove packages not required by another package using ``apt-get
      autoremove``.
  
      list_only : False
          Only retrieve the list of packages to be auto-removed, do not actually
          perform the auto-removal.
  
      purge : False
          Also remove package config data when autoremoving packages.
  
          .. versionadded:: 2015.8.0
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' pkg.autoremove
          salt '*' pkg.autoremove list_only=True
          salt '*' pkg.autoremove purge=True
      '''
      cmd = []
      if list_only:
          ret = []
          cmd.extend(['apt-get', '--assume-no'])
          if purge:
              cmd.append('--purge')
          cmd.append('autoremove')
          out = _call_apt(cmd, ignore_retcode=True)['stdout']
          found = False
          for line in out.splitlines():
              if found is True:
                  if line.startswith(' '):
                      ret.extend(line.split())
                  else:
                      found = False
              elif 'The following packages will be REMOVED:' in line:
                  found = True
          ret.sort()
          return ret
      else:
          old = list_pkgs()
          cmd.extend(['apt-get', '--assume-yes'])
          if purge:
              cmd.append('--purge')
          cmd.append('autoremove')
          _call_apt(cmd, ignore_retcode=True)
          __context__.pop('pkg.list_pkgs', None)
          new = list_pkgs()
          return salt.utils.data.compare_dicts(old, new)