def reraise(tpe, value, tb=None):
  " Reraise an exception from an exception info tuple. "

  Py3 = (sys.version_info[0] == 3)
  if value is None:
    value = tpe()
  if Py3:
    if value.__traceback__ is not tb:
      raise value.with_traceback(tb)
    raise value
  else:
      exec('raise tpe, value, tb')
Reraise an exception from an exception info tuple.