SyntaxError: 'await' outside function reticulate async connection to api

When trying to access a streaming data feed from within a Python code chunk I get the above error. When in a standalone Python IDE - PyCharm, the code works (see code below).