title: Python Kill a program but check first
body: <p>I have a code to kill my application through task manager and it works successfully. However, now I want to first check if the program exists before it kills it, any suggestions?</p>
  
  <pre><code>def close_SAP()"
     call('taskkill /im saplogon.exe /t /f')
  
  if __name__ == '__main__':
     close_SAP()
  </code></pre>