refuctoring by flake8