from functools import wraps


def print_task(fn, *args, **kwargs):
def _decorate(fn, *args, **kwargs):
@wraps(fn)
def wrapper(*args, **kwargs):
print args[0]
out = apply(fn, args, kwargs)
return out
return wrapper
print fn.__name__
if fn:
return _decorate(fn)
return _decorate

@print_task
def a(x):
print "i am a"
print x


a("sads")



--------------------------------------------------out:
a
sads
i am a
sads