code: def _trace (frame, event, arg):
      
      if event in ('call', 'c_call'):
          _trace_line(frame, event, arg)
      elif event in ('return', 'c_return'):
          _trace_line(frame, event, arg)
          print("  return:", arg)
      #elif event in ('exception', 'c_exception'):
      #    _trace_line(frame, event, arg)
      return _trace
docs: Trace function calls.