More fixes in the Python sample backend

There's a patch in the next pull request (already prepare) that removes the magic numbers