Python code: UTFGrid