def METHOD_NAME(self, q) -> bool:
    cur_win_floating = q.current_window and q.current_window.floating
    if self._focused:
        if q.current_window and not self._focused.compare(q.current_window):
            return False
        if not q.current_window and not self._if_no_focused:
            return False
    if cur_win_floating and not self._when_floating:
        return False
    if self._layouts and q.current_layout.name not in self._layouts:
        return False
    return True