Determine where a class is imported from in python
Question: Is there any way to determine where a class is coming from in python
(especially sklearn)? I want to determine if a class is from
sklearn.linear_models or sklearn.ensemble.

As an example, I would like to be able to determine if Ridge() is a member of
sklearn.linear_model.

The fit function is a bit different depending on the model so formulas fed to
each via patsy need to be different.


Answer: Use the `__module__` attribute, i.e.: `Ridge.__module__`

If you want to know it from an instance of the class:
`inst.__class__.__module__`

If you need the module object (not just the name as string):
`sys.modules[Ridge.__module__]`

