code: def tracing(pattern=None, out=None):
      
      _trace = partial(trace_line, pattern)
  
      if out is None:
          out = sys.stdout
  
      with redirect_stdout(out):
          sys.settrace(_trace)
          try:
              yield
          finally:
              sys.settrace(None)
docs: Print executed lines to stdout.