Python: How to check if an imported module/package/class is from standard library
<p>Is there a possibility to verify if an import comes from the standard library or not?</p>

<p>For example:</p>

<pre><code>from math import sin #from the standard library.
from my_module import MyClass #not from the standard library.
</code></pre>
