def ftrace(func):
 def w(*args, **kargs):
  global __ftraceDepth
  pfx = ('  ' * __ftraceDepth)
  print(((pfx + func.__name__) + ' start'))
  __ftraceDepth += 1
  try:
   rv = func(*args, **kargs)
  finally:
   __ftraceDepth -= 1
  print(((pfx + func.__name__) + ' done'))
  return rv
 return w

def ftrace ( func ) : def w ( * args , ** kargs ) : global __ftraceDepth pfx = ( '  ' * __ftraceDepth ) print ( ( ( pfx + func . __name__ ) + ' start' ) ) __ftraceDepth += 1 try : rv = func ( * args , ** kargs ) finally : __ftraceDepth -= 1 print ( ( ( pfx + func . __name__ ) + ' done' ) ) return rv return w
decorator used for marking the beginning and end of function calls .