'Move window to a specified group'

def togroup(self, groupName=None):

    if (groupName is None):
        group = self.qtile.currentGroup
    else:
        group = self.qtile.groupMap.get(groupName)
        if (group is None):
            raise command.CommandError(('No    such    group:    %s' % groupName))
    if (self.group is not group):
        self.hide()
        if self.group:
            if self.group.screen:
                self.x -= self.group.screen.x
            self.group.remove(self)
        if (group.screen and (self.x < group.screen.x)):
            self.x += group.screen.x
        group.add(self)
