code: def task(arg = None):
  	
  
  	# make sure stdout is patched
  	if not hasattr(sys.stdout, 'indent_level'):
  		sys.stdout = IndentedFile(sys.stdout)
  
  	def decorator(base):
  		info = ': ' + arg if type(arg) is str else ''
  		header = fore.green('** ' + fore.cyan(base.__name__) + info)
  
  		def func(*args, **kwargs):
  			sys.stdout.indent_level += 1
  
  			puts(header)
  			base(*args, **kwargs)
  
  			sys.stdout.indent_level -= 1
  
  		params = inspect.formatargspec(*inspect.getargspec(base))[1:-1]
  		specformat = fore.cyan('%s') + ' ' + fore.white('%s')
  
  		func._task = True
  		func._spec = specformat % (base.__name__, params)
  		func._desc = re.sub('\s+', ' ', inspect.getdoc(base) or '')
  		return func
  
  	if type(arg) == types.FunctionType:
  		return decorator(arg)
  	else:
  		return decorator
docs: Task decorator