Fix flake8 errors

Use "not in" instead of "not key in dict"