Replaces legacy Python 2.5 code with decorators.