Functions for working with a grid of objects in python.