python: How to define decorator.