Thanks to @Markku and @BrenBarn.
Here is the solution.
First we have a simple decorator:
from functools import wraps
def my_decorator(func):
@wraps(func)
def wrapper(*args, **kwargs):
# do some stuff
retval = func(*args, **kwargs)
# do more stuff
return retval
return wrapper
And the metaclass:
class ProfileMetaByClass(type):
def __init__(cls, name, bases, dct):
for method_name, method in dct.items():
if method_name.startswith('decorate_this_'):
setattr(cls, method_name, my_decorator(method))
type.__init__(cls, name, bases, dct)
And that worked for me!