code: def get_traceback(f):
    
    @functools.wraps(f)
    def wrapper(*args, **kwargs):
      try:
        return f(*args, **kwargs)
      except Exception, ex:
        ret = '#' * 60
        ret += "\nException caught:"
        ret += "\n" + '-' * 60
        ret += "\n" + traceback.format_exc()
        ret += "\n" + '-' * 60
        ret += "\n" + "#" * 60
        print sys.stderr, ret
        sys.stderr.flush()
        raise ex
  
    return wrapper
docs: Multiprocessing doesn't forward exception traceback information. This does.
    From: http://pragmaticpython.com/2017/02/19/