code: def to_grid(self, mapping):
          
          return list(reversed([[mapping.get((x,y), None)
                                 for x in range(self.cols)]
                                for y in range(self.rows)]))
docs: Convert a mapping from (x, y) to v into a [[..., v, ...]] grid.