def _possible_grids(self, num_windows):
        """
        iterates over possible grids given a number of windows
        """
        if num_windows < 2:
            end = 2
        else:
            end = num_windows // 2 + 1
        for rows in range(1, end):
            cols = int(math.ceil(num_windows / rows))
            yield (rows, cols, ROWCOL)
            if rows != cols:
                # also want the reverse test
                yield (cols, rows, COLROW)

        iterates over possible grids given a number of windows
        
libqtile/layout/ratiotile.py