I\'m writing a decorator, and for various annoying reasons[0] it would be expedient to check if the function it is wrapping is being defined stand-alone or as part of a class (a
you can use the package wrapt to check for - instance/class methods - classes - freestanding functions/static methods:
wrapt
See the project page of wrapt: https://pypi.org/project/wrapt/