move guess_type from FileMiddleware to utils, fix loggerMiddleware for
python3