Fix various warning on accelerate module, found by pyflakes

Running pyflakes on accelerate module, i stumbled accross various warning. Most of them are harmless ( missing import, too much import ), but in order to reduce the noise, I fixed them. There is however 1 real bug in a code path executed in case of error, so likely almost never exercised.