Some elegant usage of Python's decorator