def rect(rows: int, cols: int, top: int = 0, left: int = 0, *, dimension: int) -> list[GridQid]:
        """Returns a rectangle of GridQid.

        Args:
            rows: Number of rows in the rectangle
            cols: Number of columns in the rectangle
            top: Row number of the topmost row
            left: Column number of the leftmost row
            dimension: The dimension of the qid's Hilbert space, i.e.
                the number of quantum levels.

        Returns:
            A list of GridQid filling in a rectangular grid
        """
        return [
            GridQid(row, col, dimension=dimension)
            for row in range(top, top + rows)
            for col in range(left, left + cols)
        ]
Returns a rectangle of GridQid.

        Args:
            rows: Number of rows in the rectangle
            cols: Number of columns in the rectangle
            top: Row number of the topmost row
            left: Column number of the leftmost row
            dimension: The dimension of the qid's Hilbert space, i.e.
                the number of quantum levels.

        Returns:
            A list of GridQid filling in a rectangular grid
        
cirq-core/cirq/devices/grid_qubit.py