How to fix SyntaxError: 'yield' outside function in Python | DevErrors