You can decorate it like this:
def safe_decorator(func):
def wrapper(self, *args):
result = func(self, *args)
if result is None:
raise ValueError()
return result
return wrapper
MyClass.my_method = safe_decorator(MyClass.my_method)
You can then reuse this decorator for whatever method you want from whatever class definition. This is what the @
notation does more or less :)
Hope this helps!