[1.7.x] Fixed flake8 errors.

Backport of b5a54168f9 from master