def get_first_window(self):
        """Find the first Window under this node

        Returns self if this is a `Window`, otherwise finds first `Window` by
        depth-first search
        """
        if isinstance(self, Window):
            return self
        if self.expanded:
            for i in self.children:
                node = i.get_first_window()
                if node:
                    return node
Find the first Window under this node

        Returns self if this is a `Window`, otherwise finds first `Window` by
        depth-first search
        
libqtile/layout/tree.py