def print_profile(function):
import memory_profiler<EOL>def wrapper(*args,**kwargs):<EOL><INDENT>m=StringIO()<EOL>pr=cProfile.Profile()<EOL>pr.enable()<EOL>temp_func = memory_profiler.profile(func=function,stream=m,precision=<NUM_LIT:4>)<EOL>output = temp_func(*args,**kwargs)<EOL>print(m.getvalue())<EOL>pr.disable()<EOL>ps = pstats.Stats(pr)<EOL>ps.sort_stats('<STR_LIT>').print_stats('<STR_LIT>',<NUM_LIT:20>)<EOL>m.close()<EOL>return output<EOL><DEDENT>return wrapper<EOL>
Decorator that prints memory and runtime information at each call of the function