This seems strange. Perhaps I've missed something obvious but why not just 
```python
var awty = (function() {
...
})();
```
Isn't that exactly the same thing without having to mention this `window` thing.