change print to logging, flake8 compliance