code: def Trace(msg, file=None, mode='w', tstamp=None):
      
      global TraceDefault
      global TimeStampDefault
      global PreviousTime
      if file is None:
          file = TraceDefault
      else:
          TraceDefault = file
      if tstamp is None:
          tstamp = TimeStampDefault
      else:
          TimeStampDefault = tstamp
      try:
          fp = TraceFP[file]
      except KeyError:
          try:
              fp = TraceFP[file] = open(file, mode)
          except TypeError:
              # Assume we were passed an open file pointer.
              fp = file
      if tstamp:
          now = time.time()
          fp.write('%8.4f %8.4f:  ' % (now - StartTime, now - PreviousTime))
          PreviousTime = now
      fp.write(msg)
      fp.flush()
      fp.close()
docs: Write a trace message to a file.  Whenever a file is specified,
      it becomes the default for the next call to Trace().