refactoring consumer.py for pylint