https://docs.python.org/2/library/inspect.html#types-and-members__module__ name of module in which this class was defined
In [1]: class a:
...: pass
...:
In [2]: b = a()
In [3]: from hashlib import md5
In [4]: c = md5()
In [24]: inspect.getmodule(a)
Out[24]: <module '__main__'>
In [25]: inspect.getmodule(b)
Out[25]: <module '__main__'>
In [27]: inspect.getmodule(c)
In [28]: inspect.getmodule(md5)
Out[28]: <module '_hashlib' from '/Users/liuqian/anaconda/lib/python3.6/lib-dynload/
_hashlib.cpython-36m-darwin.so'>