title: How to check if a module/library/package is part of the python standard library?
body: <p>I have installed sooo many libraries/modules/packages with pip and now I cannot differentiate which is native to the python standard library and which is not. This causes problem when my code works on my machine but it doesn't work anywhere else.</p>
  
  <p><strong>How can I check if a module/library/package that I import in my code is from the python stdlib?</strong> </p>
  
  <p>Assume that the checking is done on the machine with all the external libraries/modules/packages, otherwise I could simply do a try-except import on the other machine that doesn't have them.</p>
  
  <p>For example, I am sure these imports work on my machine, but when it's on a machine with only a plain Python install, it breaks:</p>
  
  <pre><code>from bs4 import BeautifulSoup
  import nltk
  import PIL
  import gensim
  </code></pre>