code: def is_rpm_package_installed(pkg):
      
  
      with settings(hide('warnings', 'running', 'stdout', 'stderr'),
                    warn_only=True, capture=True):
  
          result = sudo("rpm -q %s" % pkg)
          if result.return_code == 0:
              return True
          elif result.return_code == 1:
              return False
          else:   # print error to user
              print(result)
              raise SystemExit()
docs: checks if a particular rpm package is installed