How to resolve Key Error Exception when accessing dictionary key inside an if statement

visit shbcf.ru