def unwrap_function(func, max_depth=10):
 iteration = 0
 wrapped = getattr(func, '__wrapped__', None)
 while (wrapped and (iteration < max_depth)):
  func = wrapped
  wrapped = getattr(func, '__wrapped__', None)
  iteration += 1
 return func

def unwrap_function ( func , max_depth = 10 ) : iteration = 0 wrapped = getattr ( func , '__wrapped__' , None ) while ( wrapped and ( iteration < max_depth ) ) : func = wrapped wrapped = getattr ( func , '__wrapped__' , None ) iteration += 1 return func
unwraps a function that is wrapped with :func:functools .