'Find a group walking the groups list in the specified direction
Parameters
skip_empty :
skips the empty groups
skip_managed :
skips the groups that have a screen'

def _dirGroup(self, direction, skip_empty=False, skip_managed=False):

    def match(group):
        if (group is self):
            return True
        if (skip_empty and (not group.windows)):
            return False
        if (skip_managed and group.screen):
            return False
        return True
    groups = [group for group in self.qtile.groups if match(group)]
    index = ((groups.index(self) + direction) % len(groups))
    return groups[index]
