code: def shape(self):
          "Returns the 2D shape of the GridSpace as (rows, cols)."
          keys = self.keys()
          if self.ndims == 1:
              return (len(keys), 1)
          return len(set(k[0] for k in keys)), len(set(k[1] for k in keys)f shape(self):
          "Returns the 2D shape of the GridSpace as (rows, cols)."
          keys = self.keys()
          if self.ndims == 1:
              return (len(keys), 1)
          return len(set(k[0] for k in keys)), len(set(k[1] for k in keys))
docs: Returns the 2D shape of the GridSpace as (rows, cols).