def debugx(expr,pre_msg=''):

    cf = sys._getframe(1)
    print('[DBG:%s] %s%s -> %r' % (cf.f_code.co_name,pre_msg,expr,
                                   eval(expr,cf.f_globals,cf.f_locals)))


# deactivate it by uncommenting the following line, which makes it a no-op
#def debugx(expr,pre_msg=''): pass
Print the value of an expression from the caller's frame.
dataset/ETHPy150Open ipython/ipython-py3k/IPython/utils/frame.py/debugx