def window_size(self, landscape: Optional[bool] = None) -> WindowSize:
        """
        Return screen (width, height) in pixel, width and height will be swapped if rotation is 90 or 270

        Args:
            landscape: bool, default None, if True, return (width, height), else return (height, width)
            
        Returns:
            WindowSize
        
        Raises:
            AdbError
        """
        wsize = self._wm_size()
        if landscape is None:
            landscape = self.rotation() % 2 == 1
        logger.debug("get window size from 'wm size': %s %s", wsize, landscape)
        return WindowSize(wsize.height, wsize.width) if landscape else wsize

        Return screen (width, height) in pixel, width and height will be swapped if rotation is 90 or 270

        Args:
            landscape: bool, default None, if True, return (width, height), else return (height, width)
            
        Returns:
            WindowSize
        
        Raises:
            AdbError
        
adbutils/shell.py