refactored file according to Python style guidelines