improved python3 exceptions management