[bugfix][Python] make grid method work for Python.

2 jobs for bugfix/update-to-master in 4 minutes and 51 seconds (queued for 1 second)
latest
Status Job ID Name Coverage
  Test
passed debian-11-gcc-9-17 #244791

00:04:29

passed ubuntu-20.04-gcc-9-17 #244792

00:04:50