Tech Debt: fixed flake8 violations for complexity