human
I wrote the below code

    def write(msg):
        print(('log_thunk_trace:    %s' % msg.strip()), file=f)
    if hasattr(value, '__thunk_trace__'):
        trace2 = value.__thunk_trace__
        write('There    was    a    problem    executing    an    Op.')
        if (trace2 is None):
            write('Could    not    find    where    this    Op    was    defined.')
            write('    *    You    might    have    instantiated    this    Op    directly    instead    of    using    a    constructor.')
            write('    *    The    Op    you    constructed    might    have    been    optimized.    Try    turning    off    optimizations.')
        elif trace2:
            write('Definition    in:    ')
            for line in traceback.format_list(trace2):
                write(line)
            write('For    the    full    definition    stack    trace    set    the    Theano    flags    traceback.limit    to    -1')

What's a good function header?

Can you provide a Python program to find    where    this    Op    was    defined?
assistant
#Here is Python program to find    where    this    Op    was    defined.

def log_thunk_trace(value, f=sys.stderr):