[mapistore-python][sample-backend]: rewrite some for loops in a more pythonic way