def get_calling_mod(stack):
 form = stack[1]
 return getmodule(form[0]).__name__

def get_calling_mod ( stack ) : form = stack [ 1 ] return getmodule ( form [ 0 ] ) . __name__
retrieve the calling function based on the call stack .