code: def ddebug(msg, err=None):  # pragma: no cover
      
      import os
      if err:
          err = ''.join(traceback.format_exception(*err))
      else:
          err = ''
      sys.__stdout__.write("({}) {} {}".format(os.getpid(), msg, err)+'\n')
      sys.__stdout__.flush()
docs: err can be an instance of sys.exc_info() -- which is the latest traceback
      info