Python: get source code of an object

>>>import inspect

>>>print(inspect.getsource(object))

argument may be a module, class,method, function…..