def is_main(frame=1):
    "Return if the caller is main. Equilavent to ``__name__ == '__main__'``."
    return inspect.stack()[frame][0].f_globals['__name__'] == '__main__'
Return if the caller is main. Equilavent to ``__name__ == '__main__'``.
scripts/lcb_runner/pyext/pyext-0.7/pyext.py