def traceit(frame, event, arg):
    """
    Trace every lie of a program. Use:
        import sys
        sys.settrace(traceit)

    :param frame:
    :param event:
    :param arg:
    :return:
    """

    import linecache
    try:
        if event == "line":
            lineno = frame.f_lineno
            filename = frame.f_globals.get("__file__")

            if (filename.endswith(".pyc") or filename.endswith(".pyo")):
                filename = filename[:-1]

            name = frame.f_globals["__name__"]
            line = linecache.getline(filename, lineno)
            if name.startswith('ambry'):
                print "%s:%s: %s" % (name, lineno, line.rstrip())

    finally:
        return traceit
Trace every lie of a program. Use:
        import sys
        sys.settrace(traceit)

    :param frame:
    :param event:
    :param arg:
    :return: