def method_logger(old_method, self, *args, **kwds):
    'enhancement that logs all calls to a method'
    print '*** calling: %s%s, kwds=%s' % (old_method.__name__, args, kwds)
    return_value = old_method(self, *args, **kwds) # call the original method
    print '*** %s returns: %s' % (old_method.__name__, `return_value`)
    return return_value
enhancement that logs all calls to a method
recipes/Python/81982_Method_Enhancement/recipe-81982.py