some autopep8 fixes
added validate function