grilo: Port from JavaScript to Python

Port grilo.js to grilo.py