Only raise the exception in Python >= 2.7