title: How to check if python package is latest version programmatically?
body: <p>How do you check if a package is at its latest version programmatically in a script and return a true or false?</p>
  
  <p>I can check with a script like this:</p>
  
  <pre class="lang-py prettyprint-override"><code>package='gekko'
  import pip
  if hasattr(pip, 'main'):
      from pip import main as pipmain
  else:
      from pip._internal import main as pipmain
  pipmain(['search','gekko'])
  </code></pre>
  
  <p>or with command line: </p>
  
  <pre><code>(base) C:\User&gt;pip search gekko
  gekko (0.2.3)  - Machine learning and optimization for dynamic systems
    INSTALLED: 0.2.3 (latest)
  </code></pre>
  
  <p>But how do I check programmatically and return true or false?</p>